changeset 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 029b0442413b
children 6a773ec78813
files .shell.d/50.hg_functions.sh
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
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")