]> git.neil.brown.name Git - wiggle.git/commitdiff
Add recommit option to 'p'
authorNeil Brown <neilb@suse.de>
Sun, 21 May 2006 23:17:06 +0000 (09:17 +1000)
committerNeil Brown <neilb@suse.de>
Sun, 21 May 2006 23:17:06 +0000 (09:17 +1000)
p
p.help

diff --git a/p b/p
index 755e0a2e49bec2cece8a898e96de4208bc3b71f3..2500b662c5b22ff2e322e881db7dbcee6d97bbda 100755 (executable)
--- a/p
+++ b/p
@@ -596,6 +596,33 @@ case $cmd in
   openall )
         while p open last && p discard ; do : ; done
        ;;
+  recommit )
+       make_diff
+       get_meta
+       if [ -s .patches/patch ]
+       then
+           echo >&2 Patch $name already open - please commit ; exit 1;
+       fi
+       if [ $# -eq 0 ]
+       then
+           echo "Unapplied patches are:"
+           ls .patches/removed
+           exit 0
+       fi
+       if [ $# -ne 1 ]
+       then echo >&2 "Usage: p recommit patchname"; exit 1
+       fi
+       case $1 in
+           last ) pfile=`ls -d .patches/removed/[0-9]* | tail -1` ; echo last is "$pfile";;
+           */* ) pfile=$1 ;;
+           * ) pfile=`echo .patches/removed/*$1*`
+       esac
+       if [ ! -f "$pfile" ]
+       then echo >&2 "Cannot find unique patch '$1' - found: $pfile"; exit 1
+       fi
+       while [ -s "$pfile" ]  &&
+            p apply last && p commit ; do : ; done
+       ;;
   snapshot )
        all_files snap_one
        ;;
diff --git a/p.help b/p.help
index fc22772f77aab6f7acd8d0281373f9f6c80c5e42..4c1632813b97e442cbd0a7b98f0f0ec3cc4de311 100644 (file)
--- a/p.help
+++ b/p.help
@@ -248,6 +248,14 @@ openall
  discarded.  This is part of the preparation for incorporating
  upstream changes.
 
+recommit
+ Usage: p recommit patchname
+
+ This command will re-apply and re-commit removed patches
+ that successfully apply until the names patch has been applied.
+ Patches are applied in reverse order, which is consistant with
+ the order in which they were removed.
+
 snapshot
  Usage: p snapshot