diff .shell.d/50.hg_functions.sh @ 309:74990ae54bd2

hg-rebase-all: defend against no bookmarks being set
author Augie Fackler <raf@durin42.com>
date Tue, 29 Jan 2013 16:01:40 -0500
parents d9cc862e6308
children 2b129f63d910
line wrap: on
line diff
--- a/.shell.d/50.hg_functions.sh
+++ b/.shell.d/50.hg_functions.sh
@@ -22,7 +22,11 @@ function hg_rebase_all () {
         echo 'abort: tip is essentially never what you mean here'
         return 2
     fi
-    for b in $(hg book | sed 's/^ \*/  /' | awk '{ print $1 }') ; do
+    marks=$(hg book | sed 's/^ \*/  /' | awk '{ print $1 }')
+    if [ "$marks" = "no bookmarks set" ] ; then
+      echo "no bookmarks set, nothing to rebase"
+    fi
+    for b in $(echo $marks) ; do
         echo "About to rebase $b"
         hg co --clean $b
         out=$(hg rebase -d "$1")