Hi All, I've been using quilt for a while now as a patch queue in front of subversion, with some success. One of the places where this doesn't work so well is on commit: once changes are committed I need to tell quilt to forget about them. This usually involves deleting the patch from quilt's queue and then using svn revert or manually applying the newly-deleted patch in order to restore those files to their committed state. What I really want to be able to do is tell quilt to quietly discard the patch without reverting the associated files.
Also, sometimes I don't want to commit all of the files in a patch (usually because I'm too lazy to split the patch up into smaller pieces before I commit), and so I'd like to be able to commit some files and then quietly remove those from the the quilt patch. Attached is a patch which adds a -k flag to both quilt remove and quilt delete. When this flag is provided the operation does not modify the files in the working directory. Would you consider adding something like this to the official distribution? Thanks, -Ted
>From 386c62797f9c95409fa4b1ed87b427fcb37f42a8 Mon Sep 17 00:00:00 2001 From: Ted Phelps <[email protected]> Date: Sun, 21 Feb 2010 17:01:49 +1000 Subject: [PATCH] Add an option to quilt remove/delete to preserve the original file contents. Sometimes it's useful to be able to remove files from a patch, or to remove an entire patch, without reverting the contents of those files. For example, after commiting those files to a revision control system. Add a -k flag to allow this. --- quilt/delete.in | 9 +++++++-- quilt/remove.in | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/quilt/delete.in b/quilt/delete.in index 240a43b..d29a65c 100644 --- a/quilt/delete.in +++ b/quilt/delete.in @@ -27,6 +27,8 @@ Remove the specified or topmost patch from the series file. If the patch is applied, quilt will attempt to remove it first. (Only the topmost patch can be removed right now.) +-k Don't revert the files associated with the patch. + -n Delete the next patch after topmost, rather than the specified or topmost patch. @@ -43,7 +45,7 @@ topmost patch can be removed right now.) fi } -options=`getopt -o nrh --long backup -- "$@"` +options=`getopt -o knrh --long backup -- "$@"` if [ $? -ne 0 ] then @@ -55,6 +57,9 @@ eval set -- "$options" while true do case "$1" in + -k) + opt_keep=1 + shift ;; -n) opt_next=1 shift ;; @@ -103,7 +108,7 @@ if is_applied "$patch"; then "$(print_patch "$patch")" >&2 exit 1 fi - if ! quilt_command pop -fq + if [ -z "$opt_keep" ] && ! quilt_command pop -fq then exit 1 fi diff --git a/quilt/remove.in b/quilt/remove.in index 96a4e86..25bdd22 100644 --- a/quilt/remove.in +++ b/quilt/remove.in @@ -19,13 +19,15 @@ fi usage() { - printf $"Usage: quilt remove [-P patch] {file} ...\n" + printf $"Usage: quilt remove [-k] [-P patch] {file} ...\n" if [ x$1 = x-h ] then printf $" Remove one or more files from the topmost or named patch. Files that are modified by patches on top of the specified patch cannot be removed. +-k Keep the files' current contents, but remove them from the patch. + -P patch Remove named files from the named patch. " @@ -35,7 +37,7 @@ are modified by patches on top of the specified patch cannot be removed. fi } -options=`getopt -o P:h -- "$@"` +options=`getopt -o kP:h -- "$@"` if [ $? -ne 0 ] then @@ -50,6 +52,9 @@ do -P) opt_patch="$2" shift 2 ;; + -k) + opt_keep=1 + shift ;; -h) usage -h ;; --) @@ -85,8 +90,15 @@ do continue fi + if [ -z "$opt_keep" ] + then + FLAGS="-r -t" + else + FLAGS="-x" + fi + # Restore file from backup - if ! $QUILT_LIB/backup-files -r -t -s -B $QUILT_PC/$patch/ "$SUBDIR$file" + if ! $QUILT_LIB/backup-files $FLAGS -s -B $QUILT_PC/$patch/ "$SUBDIR$file" then printf $"Failed to remove file %s from patch %s\n" \ "$SUBDIR$file" "$(print_patch $patch)" >&2 -- 1.7.0
_______________________________________________ Quilt-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/quilt-dev
