X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/5a30e78c803f59d6b134dea657d90ebb42ea3b3a..1d694f9b45e3dfef8916cf3d09e02ab4553f2030:/contrib/stg-dispatch?ds=sidebyside diff --git a/contrib/stg-dispatch b/contrib/stg-dispatch index 8911946..e98d91b 100755 --- a/contrib/stg-dispatch +++ b/contrib/stg-dispatch @@ -6,7 +6,7 @@ set -e # do so), but from the patch containing the changes to migrate, # instead of doing so from the target patch. -# usage: stg-dispatch [-#[-][,]...] +# usage: stg-dispatch [-n] [-#[-][,]...] # Copyright (c) 2007 Yann Dirson # Subject to the GNU GPL, version 2. @@ -17,10 +17,16 @@ die() exit 1 } +noact=0 +if [ "x$1" = "x-n" ]; then + noact=1 + shift +fi + TOPATCH="$1" shift -stg applied | grep "^$TOPATCH\$" >/dev/null || +stg series --applied --noprefix | grep "^$TOPATCH\$" >/dev/null || die "cannot dispatch to unapplied patch '$TOPATCH'" CURRENTPATCH=$(stg top) @@ -28,7 +34,11 @@ CURRENTPATCH=$(stg top) [ "x$TOPATCH" != "x$CURRENTPATCH" ] || die "dispatching to current patch ($CURRENTPATCH) makes no sense" -stg goto "$TOPATCH" -stg-fold-files-from "$CURRENTPATCH" "$@" -stg refresh -stg goto "$CURRENTPATCH" +if [ $noact = 1 ]; then + stg-fold-files-from "$CURRENTPATCH" -n "$@" +else + stg goto "$TOPATCH" + stg-fold-files-from "$CURRENTPATCH" "$@" + stg refresh + stg goto "$CURRENTPATCH" +fi