diff .shell.d/50.hg_functions.sh @ 231:6da5a4729bc7

hg-rebase-all: fix bogus loop
author Augie Fackler <durin42@gmail.com>
date Sat, 09 Oct 2010 15:47:24 -0500
parents 0c8939baa35c
children 369d869082fd
line wrap: on
line diff
--- a/.shell.d/50.hg_functions.sh
+++ b/.shell.d/50.hg_functions.sh
@@ -22,7 +22,7 @@ function hg_rebase_all () {
 	return 2
     fi
     for b in $(hg book | sed 's/^ \*/  /' | awk '{ print $1 }') ; do
-	hg co --clean $book
+	hg co --clean $b
 	hg rebase -d "$1"
     done
 }
@@ -44,18 +44,18 @@ alias hg-svn-merge-branch=hgsvnmergebran
 function hgsvnrebaseall() {
     for b in `hg log -u 'Augie Fackler <durin42@gmail.com>' --template '{branches}\n' | sort | uniq`
     do
-        echo "rebase $b"
-        hg co $b
-        if [[ "$?" != "0" ]] ; then
-            echo "abort: could not checkout $b"
-            return
-        fi
-        hg parent --svn > /dev/null
-        if [[ "$?" == "0" ]] ; then
-            hg rebase --svn || return
-        else
-            echo "Skip $b since it has a merge."
-        fi
+	echo "rebase $b"
+	hg co $b
+	if [[ "$?" != "0" ]] ; then
+	    echo "abort: could not checkout $b"
+	    return
+	fi
+	hg parent --svn > /dev/null
+	if [[ "$?" == "0" ]] ; then
+	    hg rebase --svn || return
+	else
+	    echo "Skip $b since it has a merge."
+	fi
     done
 }
 alias hg-svn-rebase-all=hgsvnrebaseall
@@ -78,22 +78,22 @@ function hgsvnmkbranch() {
     upstream=$(hg paths default | sed 's%/*$%%')
     local branchname
     if [ "x$1" = "x" ] ; then
-        echo 'Must provide new branch name.'
-        return 1
+	echo 'Must provide new branch name.'
+	return 1
     fi
     local d=`hg svn info | grep URL | sed 's/.*://'`
     local br=`echo $d | awk '{
-            if ( index($1, "trunk") ) {
-                    print  "trunk"
-                } else {
-                    x = index($1, "branches") ;
-                    if ( x != 0 ) {
-                            sub(".*/branches/", "");
-                            sub("/.*", "");
-                            print $0
-                        }
-                }
-                }'`
+	    if ( index($1, "trunk") ) {
+		    print  "trunk"
+		} else {
+		    x = index($1, "branches") ;
+		    if ( x != 0 ) {
+			    sub(".*/branches/", "");
+			    sub("/.*", "");
+			    print $0
+			}
+		}
+		}'`
 
     branchname=$br
     echo svn cp $upstream/$branchname $upstream/branches/$1