use the correct branch source in admin-merge-2 and branch ops
authorRudolf Polzer <divverent@alientrap.org>
Tue, 25 May 2010 14:28:12 +0000 (16:28 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 25 May 2010 14:28:12 +0000 (16:28 +0200)
all

diff --git a/all b/all
index 4c649642fa6276bd0ad4c4a5e44285aa7ac625ce..60bb471e380ad244f7dd65ffbad1ec31fa41a0b1 100755 (executable)
--- a/all
+++ b/all
@@ -309,7 +309,6 @@ case "$cmd" in
                                                verbose git checkout -b "$branch" "$b"
                                                verbose git config "branch.$branch.remote" "$remote"
                                                verbose git config "branch.$branch.merge" "refs/heads/$branch"
-                                               verbose git push origin "$branch"
                                        fi
                                fi
                                cd "$d0"
@@ -415,7 +414,12 @@ case "$cmd" in
                                fi
                        fi
                        rem=`git config "branch.$r.remote" || echo origin`
-                       if { git log "$rem/$r".."$r" || git log origin/"`repobranch "$d"`".."$r"; } | grep .; then
+                       bra=`git config "branch.$r.merge" || echo "$r"`
+                       upstream="$rem/$bra"
+                       if ! [ git rev-parse "$upstream" ]; then
+                               upstream="`repobranch "$d"`"
+                       fi
+                       if git log "$upstream".."$r" | grep .; then
                                if yesno "Push \"$r\" in $dv?"; then
                                        verbose git push "$rem" HEAD
                                fi
@@ -423,7 +427,7 @@ case "$cmd" in
                        if [ x"$submit" = x"-s" ]; then
                                case "$r" in
                                        */*)
-                                               verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
+                                               verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
                                                ;;
                                esac
                        fi
@@ -650,10 +654,11 @@ case "$cmd" in
                }
                for d in $repos; do
                        enter "$d0/$d" verbose
+                       base="`repobranch "$d"`"
                        reportecho "In $d:"
                        for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
                                case "${ref#refs/remotes/origin/}" in
-                                       "`repobranch "$d"`")
+                                       "$base")
                                                continue
                                                ;;
                                        HEAD|master)
@@ -665,8 +670,8 @@ case "$cmd" in
                                if [ -n "$note" ]; then
                                        reportdo4 echo "$note"
                                        reportecho4 "--> not merging, already had this one rejected before"
-                               elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ git log --color master.."$ref"; git diff --color --find-copies-harder --ignore-space-change master..."$ref"; } | less -r'; then
-                                       git checkout master
+                               elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ git log --color "$base".."$ref"; git diff --color --find-copies-harder --ignore-space-change "$base"..."$ref"; } | less -r'; then
+                                       git checkout "$base"
                                        org=`git rev-parse HEAD`
                                        if ! git merge "$ref" 2>&1 | tee "$t"; then
                                                git reset --hard "$org"
@@ -687,9 +692,11 @@ case "$cmd" in
                                        else
                                                case ",`repoflags "$d"`," in
                                                        *,svn,*)
-                                                               git pull
-                                                               git rebase -i "$org"
+                                                               # we do quite a mess here... luckily we know $org
+                                                               git pull # svn needs to be current
+                                                               git rebase -i --onto master "$org"
                                                                git svn dcommit --add-author-from
+                                                               git reset --hard "$org"
                                                                ;;
                                                        *)
                                                                git push origin HEAD