# HG changeset patch # User Augie Fackler # Date 1286657244 18000 # Node ID 6da5a4729bc7f0f3d467faef68b123473bc4874f # Parent ff600674c7011b03e73360ccb2b8c57074913ded hg-rebase-all: fix bogus loop diff --git a/.shell.d/50.hg_functions.sh b/.shell.d/50.hg_functions.sh --- 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 ' --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