]> git.neil.brown.name Git - wiggle.git/commitdiff
Define 'p unapply'
authorNeil Brown <neilb@suse.de>
Tue, 13 Jun 2006 12:57:01 +0000 (22:57 +1000)
committerNeil Brown <neilb@suse.de>
Tue, 13 Jun 2006 12:57:01 +0000 (22:57 +1000)
This reverses an applied patch that was forced in.
It goes back to the removed directory exactly as it was.

Signed-off-by: Neil Brown <neilb@suse.de>
p

diff --git a/p b/p
index eaab2d344caa46816f2296eac488dad0eb5c49ea..4f6d47558a3c50a1be40af055ed5216cb58c6c24 100755 (executable)
--- a/p
+++ b/p
@@ -724,11 +724,12 @@ case $cmd in
        then echo OK, it seems to apply
        elif [ -n "$force" ]
        then echo "It doesn't apply cleanly, but you asked for it...."
-           echo "Saving original at .patches/last-applied"
-           cp $pfile .patches/last-applied
+           echo "Saving original at .patches/last-conflict"
+           cp $pfile .patches/last-conflict
        else echo >&2 "Sorry, patch doesn't apply"; exit 1
        fi
        # lets go for it ...
+       cp $pfile .patches/last-applied
        patch --fuzz=0 -f -p$prefix < "$pfile" | tee .patches/tmp
        sed -n -e '2q' -e 's/^Status: *//p' $pfile > .patches/status
        base=${pfile##*/}
@@ -751,6 +752,16 @@ case $cmd in
         esac
        ;;
 
+  unapply )
+       get_meta
+       mv .patches/last-applied .patches/patch
+       save_patch removed $name
+       echo Restored to $new$name
+       make_diff
+       mv .patches/patch .patches/last-purge
+       all_files discard_one
+       rm -f .patches/name .patches/status .patches/notes
+       ;;
   publish )
        name=`date -u +%Y-%m-%d-%H`
        if [ -d .patches/dest ]