changeset 228:0c8939baa35c

hg-rebase-all: new function to rebase all bookmarked revisions
author Augie Fackler <durin42@gmail.com>
date Sat, 09 Oct 2010 15:21:50 -0500
parents e8170eba88cd
children e5a40e768cf8
files .shell.d/50.hg_functions.sh
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.shell.d/50.hg_functions.sh
+++ b/.shell.d/50.hg_functions.sh
@@ -11,6 +11,23 @@ function mq-snapshot () {
     mq ci -m "Applied on $(hg log -r qparent --template '{node|short}\n')"
 }
 
+function hg_rebase_all () {
+    hg sum | grep 'commit: .* (clean)$' || (echo 'abort: wc not clean' ; return 1) || return 1
+    if [ "x$1" = "x" ] ; then
+	echo 'abort: give destination for rebase'
+	return 2
+    fi
+    if [ "$1" = "tip" ] ; then
+	echo 'abort: tip is essentially never what you mean here'
+	return 2
+    fi
+    for b in $(hg book | sed 's/^ \*/  /' | awk '{ print $1 }') ; do
+	hg co --clean $book
+	hg rebase -d "$1"
+    done
+}
+alias hg-rebase-all=hg_rebase_all
+
 function hgsvnmergebranch() {
     local targetrev
     local striprev