# HG changeset patch # User Augie Fackler # Date 1286655710 18000 # Node ID 0c8939baa35ca6fe03246dbf80f3510dccf0de6c # Parent e8170eba88cd0b21873b54898900873163815a2d hg-rebase-all: new function to rebase all bookmarked revisions 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 @@ -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