]> Pileus Git - ~andy/sunrise/commitdiff
app-portage/overlay-utils: Version bump, switch to git
authorThomas Sachau <tommy@gentoo.org>
Mon, 2 Apr 2012 14:42:43 +0000 (16:42 +0200)
committerThomas Sachau <tommy@gentoo.org>
Mon, 2 Apr 2012 14:42:43 +0000 (16:42 +0200)
app-portage/overlay-utils/ChangeLog
app-portage/overlay-utils/Manifest
app-portage/overlay-utils/files/sunrise-commit
app-portage/overlay-utils/overlay-utils-0.3.ebuild [moved from app-portage/overlay-utils/overlay-utils-0.2.1-r1.ebuild with 85% similarity]

index 7ee9eaf5eef6b87349ffe241cb1b418ed4509948..d627fda5dda97da5460d4a3988c7141cf7e51a7a 100644 (file)
@@ -2,6 +2,13 @@
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+*overlay-utils-0.3 (02 Apr 2012)
+
+  02 Apr 2012; Thomas Sachau (Tommy[D]) <tommy@gentoo.org>
+  -overlay-utils-0.2.1-r1.ebuild, +overlay-utils-0.3.ebuild,
+  files/sunrise-commit:
+  Version bump, switch to git
+
   16 Mar 2012; Mike Gilbert <floppym@gentoo.org> overlay-utils-0.2.1-r1.ebuild,
   +files/sunrise-commit, +files/sunrise-commit.1:
   Move sunrise-commit source to FILESDIR.
index 3d1c4f5ba4f9f12d840617a22f11017c3a4a38b7..4ac5ce904189ee6cd9e1187b0296075251439df5 100644 (file)
@@ -1,15 +1,5 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
-AUX sunrise-commit 8833 RMD160 e5e3808bd736d3becdd074839e19c3818dd73409 SHA1 5b07fdb0b5fdc814474afe524bfdca731618087a SHA256 207217486532d5cfb34f8e5535c0f66211e823cc97b2f015fc558539fd44af3e
+AUX sunrise-commit 7949 RMD160 eab827ea2a54a04d0f99ca7623c8949b2f3b039e SHA1 fa3d571682d3f88eb6f131d86cbd9d423c7e72dc SHA256 175cbd159ec89b5e69f7d51f995dfb69525c0afcce6092a785640f58b8eb5516
 AUX sunrise-commit.1 7607 RMD160 52e4e7df66661705f05df4167b80e68cffaafddb SHA1 647084334a6d24c51d3f4052b1a469e56d09c078 SHA256 5b6c2b68eeb45f0eb864c0efb787e8622bb7d80119812218e45c82bb04926bd3
-EBUILD overlay-utils-0.2.1-r1.ebuild 509 RMD160 24b5d144e81ff562f8d677103304c4d6a1d571da SHA1 a3401ffafd0a0e6e1a687d31615a62de8a158978 SHA256 6e532c6d40fcf4c3acc96cb544f77f2d0f2ffb635689229750f1e70b3323eb97
-MISC ChangeLog 3346 RMD160 2e870df40d4e3e7948c0d3d44f1067955adceecd SHA1 72a9b03a4f86e980d1bae90c0b3921fa79197543 SHA256 602a85d90e132a1e87a99f9c2a315b98a3f70bbce05eea59b11697c6bcaf9325
+EBUILD overlay-utils-0.3.ebuild 549 RMD160 00a30a17fef4a87b65ce2399d90640768932c465 SHA1 7beb95012785130f0feb78326e52f2c507b57d5e SHA256 07fb36b8dd23ad7b541a90b9047f185fa87817e253a242fb7d118ac577acc7c1
+MISC ChangeLog 3555 RMD160 e39896e6dc10705740df8c7ada6d36fd07364009 SHA1 c12ef43296ca93dc4f69265ce31b10dcb0d990e4 SHA256 239cfb090daac8aad16c28fd6044a5772b59415766cd6354e459f4f919470858
 MISC metadata.xml 208 RMD160 c18611400760e42bdd001905be0a63c2e963bcea SHA1 595816105cac477cb85792a182e15888029118a1 SHA256 c4841c87f0c2b9b5e679a27dc72180be8d508fb3f5df0fbab2ec2c805c0a6d82
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.17 (GNU/Linux)
-
-iF4EAREIAAYFAk9jk7oACgkQC77qH+pIQ6RHRwEAw5VLk8SxOTBZkyTqR4FcdtUv
-LklnHhPXo7JMJjd4kqcA/3GiHz8OnYTcpWoI0xbE7Nu5k8JwLbEKZQgH4/gC9B7+
-=1kjg
------END PGP SIGNATURE-----
index 9fb7e83549f449a01a9bb44909d26f38fa2ace94..bae31ed9464810cfd34aec147f48cab7f950d852 100644 (file)
@@ -12,38 +12,30 @@ LIGHTBLUE=$HILITE
 RED=$BAD
 YELLOW=$WARN
 
-commit_category="$(pwd | awk -F/ '{ print $(NF-1) }')"
-commit_package="$(pwd | awk -F/ '{ print $NF }')"
-current_svn_status=( )
+commit_path=
+
+current_git_status=( )
 cwd_is_ebuild_dir=0
 items_added=( )
-items_conflicted=( )
 items_deleted=( )
-items_ignored=( )
-items_missing=( )
 items_modified=( )
-items_not_modified=( )
 items_not_version_controlled=( )
-items_obstructed=( )
-items_replaced=( )
-items_used_by_externals=( )
-num_new_dirs=0
 opt_changelog=0
 opt_noformat=0
 opt_norepoman=0
-opt_noupdate=0
+opt_local=0
 opt_quiet=0
 opt_verbose=0
 
 changelog_append() {
        if [[ $opt_changelog == 1 ]] ; then
-               get_current_svn_status
-               if [[ "${current_svn_status[*]}" =~ "ChangeLog" ]] ; then
+               get_current_git_status
+               if [[ "${current_git_status[*]}" =~ "ChangeLog" ]] ; then
                        echo "!!! Error: Only one ChangeLog entry should be made per commit, and you have"
                        echo "!!! already modified your ChangeLog locally since your last commit. To keep the"
                        echo "!!! pre-existing modifications please run sunrise-commit again without the -c"
                        echo "!!! option. To discard the pre-existing modifications run:"
-                       echo "!!!   svn revert ChangeLog"
+                       echo "!!!   git reset HEAD ChangeLog ; git checkout ChangeLog"
                        echo "!!!"
                        echo -n "!!! "
                        echo -n "${BOLD}Are you SURE you want to append to ChangeLog?${NORMAL} [${GREEN}No${NORMAL}/${RED}Yes${NORMAL}] "
@@ -64,8 +56,6 @@ changelog_append() {
                        esac
                fi
                ebegin "Appending/creating ChangeLog"
-#        [ -e $(dirname $0)/echangelog ] && ec="$(dirname $0)/echangelog" || ec="echangelog"
-#        $ec "$*"
                echangelog "$*"
                eend $?
        fi
@@ -75,55 +65,63 @@ create_digests() {
        if [[ $cwd_is_ebuild_dir == 1 ]] ; then
                ebegin "Digesting ebuilds"
                for i in *.ebuild ; do
-                       ebuild $i digest
+                       ebuild "$i" manifest
+                       break
                done
                eend $?
        fi
 }
 
-# Sort current changed items into arrays based on symbols in `svn status`
+# Sort current changed items into arrays based on symbols in `git status`
 # output. For now we're only concerned with the symbols in the first column of
-# the output. See `svn help status` for symbol definitions.
+# the output. See `git help status` for symbol definitions.
 #
 # Returns with exit status 1 if the current dir isn't under version control.
-get_current_svn_status() {
+get_current_git_status() {
        local IFS_SAVED="$IFS"
-       local item column_1 #column_2 column_3 column_4 column_5 column_6
+       local item column_1 column_2
        IFS=$'\n'
-       current_svn_status=( )
+       current_git_status=( )
        items_added=( )
-       items_conflicted=( )
        items_deleted=( )
-       items_ignored=( )
-       items_missing=( )
        items_modified=( )
-       items_not_modified=( )
        items_not_version_controlled=( )
-       items_obstructed=( )
-       items_replaced=( )
-       items_used_by_externals=( )
-       for line in $(svn status 2>&1) ; do
-               [[ "$line" =~ "is not a working copy" ]] && return 1
-               current_svn_status[${#current_svn_status[*]}]=$line
+       items2_deleted=( )
+       items2_modified=( )
+       for line in $(git status --porcelain -uall 2>&1) ; do
+               [[ "$line" =~ "Not a git repository" ]] && return 1
+               current_git_status+=( "$line" )
                column_1=${line:0:1}
-               #column_2=${line:1:1}
-               #column_3=${line:2:1}
-               #column_4=${line:3:1}
-               #column_5=${line:4:1}
-               #column_6=${line:5:1}
-               item=${line:7}
+               column_2=${line:1:1}
+               item=${line:3}
+
+               # Use the first item in the commit message
+               if [[ -z $commit_path ]]; then
+                       case "$item" in
+                               *-*/*/*)
+                                       commit_path=$(awk -F/ '{ print $1 "/" $2 }' <<<"$item") ;;
+                               *)
+                                       # Not a package; use full path
+                                       commit_path=$item ;;
+                       esac
+               fi
+
                case $column_1 in
-                       ' ') items_not_modified[${#items_not_modified[*]}]=$item ;;
-                       A)   items_added[${#items_added[*]}]=$item ;;
-                       C)   items_conflicted[${#items_conflicted[*]}]=$item ;;
-                       D)   items_deleted[${#items_deleted[*]}]=$item ;;
-                       I)   items_ignored[${#items_ignored[*]}]=$item ;;
-                       M)   items_modified[${#items_modified[*]}]=$item ;;
-                       R)   items_replaced[${#items_replaced[*]}]=$item ;;
-                       X)   items_used_by_externals[${#items_used_by_externals[*]}]=$item ;;
-                       !)   items_missing[${#items_missing[*]}]=$item ;;
-                       ?)   items_not_version_controlled[${#items_not_version_controlled[*]}]=$item ;;
-                       ~)   items_obstructed[${#items_obstructed[*]}]=$item ;;
+                       A)   items_added+=( "$item" ) ;;
+                       D)   items_deleted+=( "$item" ) ;;
+                       M)   items_modified+=( "$item" ) ;;
+                       R)      case $column_2 in
+                                       D)   items2_deleted+=( "$item" ) ;;
+                                       M)   items2_modified+=( "$(echo "${item}" | cut -d ' ' -f3 )" ) ;;
+                               esac ;;
+                       "?")   items_not_version_controlled+=( "$item" ) ;;
+               esac
+               case $column_1 in
+                       ' '|A|D|M)
+                       case $column_2 in
+                               D)   items2_deleted+=( "$item" ) ;;
+                               M)   items2_modified+=( "$item" ) ;;
+                       esac ;;
                esac
        done
        IFS="$IFS_SAVED"
@@ -133,32 +131,48 @@ repoman_check() {
        if [[ $opt_norepoman == 0 ]] ; then
                if [[ $cwd_is_ebuild_dir == 1 ]] ; then
                        ebegin "Running repoman"
-                       export PORTDIR_OVERLAY="$(dirname $(dirname $(pwd)))"
+                       export PORTDIR_OVERLAY="$(dirname "$(dirname "$(pwd)")")"
                        repoman
                        eend $?
                fi
        fi
 }
 
-svn_add() {
+git_add() {
        local num_unversioned_dirs=0
 
-       while ! get_current_svn_status ; do
+       while ! [[ -e .git ]] ; do
                (( num_unversioned_dirs++ ))
-               pushd .. >/dev/null
+               pushd .. >/dev/null 2>&1
+               if [[ $? == 1 ]] ; then
+                       (( num_unversioned_dirs-- ))
+                       cd .. 2>/dev/null
+               fi
        done
 
+       get_current_git_status
+
        ebegin "Adding local changes to working copy"
        if [[ ${#items_not_version_controlled[*]} > 0 ]] ; then
                if [[ $opt_verbose == 1 ]] ; then
-                       svn add ${items_not_version_controlled[@]} || set $?
+                       git add -v -- "${items_not_version_controlled[@]}" || set $?
                else
-                       svn add -q ${items_not_version_controlled[@]} || set $?
+                       git add -- "${items_not_version_controlled[@]}" || set $?
                fi
        fi
-       eend ${1:-0}
 
-       num_new_dirs=$num_unversioned_dirs
+       if [[ ${#items2_modified[*]} > 0 ]] ; then
+               if [[ $opt_verbose == 1 ]] ; then
+                       git add -v -- "${items2_modified[@]}" || set $?
+               else
+                       git add -- "${items2_modified[@]}" || set $?
+               fi
+       fi
+
+       if [[ ${#items2_deleted[*]} > 0 ]] ; then
+               git rm -- "${items2_deleted[@]}" || set $?
+       fi
+       eend ${1:-0}
 
        for (( i=num_unversioned_dirs ; i > 0 ; i-- )) ; do
                popd >/dev/null
@@ -167,33 +181,25 @@ svn_add() {
        return ${1:-0}
 }
 
-svn_commit() {
+git_commit() {
        local commit_message="$*"
 
-       get_current_svn_status
-       if [[ ${#current_svn_status[*]} == 0 ]] ; then
+       get_current_git_status
+       if [[ ${#current_git_status[*]} == 0 ]] ; then
                echo "!!! Error: No working copy changes found in current directory. Aborting commit."
                exit 1
        fi
 
        if [[ $opt_noformat == 0 ]] ; then
-               if [[ $cwd_is_ebuild_dir == 1 ]] ; then
-                       commit_message="${commit_category}/${commit_package}: ${commit_message}"
-               else
-                       commit_message="${commit_package}/${current_svn_status[0]:7}: ${commit_message}"
-               fi
+               commit_message="${commit_path}: ${commit_message}"
        fi
 
-       for (( i=num_new_dirs ; i > 0 ; i-- )) ; do
-               cd ..
-       done
-
        echo
        echo "${DARKGREEN}The following local changes will be committed to the repository:${NORMAL}"
        echo
 
-       get_current_svn_status
-       for item in "${current_svn_status[@]}" ; do
+       get_current_git_status
+       for item in "${current_git_status[@]}" ; do
                echo "$item"
        done
 
@@ -220,44 +226,39 @@ svn_commit() {
        fi
 
        ebegin "Committing working copy to repository"
-       svn commit -m "$commit_message"
+       git commit -m "$commit_message"
        eend $?
 }
 
-svn_up() {
-       if [[ $opt_noupdate == 0 ]] ; then
-               for (( i=num_new_dirs ; i > 0 ; i-- )) ; do
-                       pushd .. >/dev/null
-               done
+git_up() {
+       if [[ $opt_local == 0 ]] ; then
 
                ebegin "Updating working copy to latest version from repository"
 
                if [[ $opt_verbose == 1 ]] ; then
-                       svn update || set $?  
+                       git pull --rebase -v origin master || set $?  
                else
-                       svn update -q || set $?
+                       git pull --rebase origin master || set $?
                fi
 
                eend ${1:-0}
 
-               for (( i=num_new_dirs ; i > 0 ; i-- )) ; do
-                       popd >/dev/null
-               done
+               get_current_git_status
+       fi
+       return ${1:-0}
+}
 
-               get_current_svn_status
-               if [[ ${#items_conflicted[*]} > 0 ]] ; then
-                       echo "!!! Error: Some local items have changes that conflict with the repository."
-                       echo "!!! Please contact the most recent committer(s) of these items and resolve the"
-                       echo "!!! conflicts manually before running sunrise-commit again:"
-                       for item in "${items_conflicted[@]}" ; do
-                               echo "!!!"
-                               echo "!!!        item: ${item}"
-                               echo "!!!   committer: $(svn info ${item} | sed -rn 's/Last Changed Author\: (.*)$/\1/p')"
-                       done
-                       exit 1
+git_push() {
+       if [[ $opt_local == 0 ]] ; then
+               ebegin "Pushing commit"
+
+               if [[ $opt_verbose == 1 ]] ; then
+                       git push -v || set $?
+               else
+                       git push || set $?
                fi
+               eend $?
        fi
-       return ${1:-0}
 }
 
 usage() {
@@ -269,7 +270,7 @@ ${GREEN}options${NORMAL}:
   ${BOLD}--help, -h${NORMAL}       Show help
   ${BOLD}--noformat, -m${NORMAL}   Disable automatic formatting of ${BLUE}message${NORMAL}
   ${BOLD}--norepoman, -p${NORMAL}  Skip repoman check
-  ${BOLD}--noupdate, -d${NORMAL}   Don't update from repository before committing
+  ${BOLD}--local, -l${NORMAL}   Don't pull/push, keep commits local
   ${BOLD}--quiet, -q${NORMAL}      Don't ask for confirmation
   ${BOLD}--verbose, -v${NORMAL}    Show detailed information during commit
 
@@ -304,8 +305,8 @@ while [[ $# > 0 ]] ; do
                        opt_norepoman=1
                        shift ;;
 
-               --noupdate|-d)
-                       opt_noupdate=1
+               --local|-l)
+                       opt_local=1
                        shift ;;
 
                --quiet|-q)
@@ -330,22 +331,15 @@ if [[ -z "$*" ]] ; then
        exit 1
 fi
 
-[[ "$(ls)" =~ \.ebuild ]] && cwd_is_ebuild_dir=1
-
-pushd . >/dev/null
-while [[ "$(echo `svn status 2>&1`)" =~ "A.+? \." ]] ; do
-       (( num_new_dirs++ ))
-       cd ..
-done
-popd >/dev/null
-
-svn_up || exit $?
+(shopt -s nullglob; f=(*.ebuild); [[ ${#f[*]} -ne 0 ]] ) && cwd_is_ebuild_dir=1
 
 [[ $cwd_is_ebuild_dir == 1 && ! -e metadata.xml ]] && cp ../../skel.metadata.xml metadata.xml >/dev/null 2>&1
 
-svn_add || exit $?
+git_add || exit $?
 changelog_append "$*" || exit $?
 create_digests || exit $?
-svn_add || exit $?
+git_add || exit $?
 repoman_check || exit $?
-svn_commit "$*" || exit $?
+git_commit "$*" || exit $?
+git_up || exit $?
+git_push || exit $?
similarity index 85%
rename from app-portage/overlay-utils/overlay-utils-0.2.1-r1.ebuild
rename to app-portage/overlay-utils/overlay-utils-0.3.ebuild
index cc63f8da56ba7f0a69fad510a462ddd30be8912d..30fceac68640aec0a0508dfed2118d8ff94b755a 100644 (file)
@@ -20,5 +20,6 @@ S=${WORKDIR}
 
 src_install() {
        dobin "${FILESDIR}"/sunrise-commit
-       doman "${FILESDIR}"/sunrise-commit.1
+# manpage is outdated with move to git
+#      doman "${FILESDIR}"/sunrise-commit.1
 }