Hi all,

This is my third attempt [1] at a patch adding an option to "quilt
delete" to delete the next patch in a series, as Greg KH and Tom Rini
suggested. I added a few missing quotes, everything seems to work fine
now. I also included a bash_completion update.

Is everyone fine with the interface I chose? Basically, using "-n" as
the patch name deletes the next patch.

Please consider for inclusion if nobody has objections. Thanks.

[1] Previous attempt is here:
http://lists.gnu.org/archive/html/quilt-dev/2005-06/msg00023.html
-- 
Jean Delvare
Index: quilt/delete.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/delete.in,v
retrieving revision 1.13
diff -u -r1.13 delete.in
--- quilt/delete.in     15 Nov 2004 22:43:19 -0000      1.13
+++ quilt/delete.in     12 Jun 2005 17:09:26 -0000
@@ -19,13 +19,16 @@
 
 usage()
 {
-       printf $"Usage: quilt delete [patch]\n"
+       printf $"Usage: quilt delete [patch | -n]\n"
        if [ x$1 = x-h ]
        then
                printf $"
 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.)
+
+-n     Delete the next patch after topmost, rather than the specified
+       or topmost patch.
 "
 
                exit 0
@@ -34,7 +37,7 @@
        fi
 }
 
-options=`getopt -o h -- "$@"`
+options=`getopt -o nh -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -46,6 +49,9 @@
 while true
 do
        case "$1" in
+       -n)
+               opt_next=1
+               shift ;;
        -h)
                usage -h ;;
        --)
@@ -54,7 +60,7 @@
        esac
 done
 
-if [ $# -gt 1 ]
+if [ $# -gt 1 -o \( -n "$opt_next" -a $# -gt 0 \) ]
 then
        usage
 fi
@@ -63,11 +69,22 @@
 if [ -z "$patch" ]
 then
        patch="$(top_patch)"
-       if [ -z "$patch" ]
+       if [ -z "$patch" -a -z "$opt_next" ]
        then
                printf $"No patches applied\n" >&2
                exit 1
        fi
+       if [ -z "$patch" ]
+       then
+               patch="$(cat_series | head -n 1)"
+       else
+               patch="$(patches_after "$patch" | head -n 1)"
+       fi
+       if [ -z "$patch" ]
+       then
+               printf $"No next patch\n" >&2
+               exit 1
+       fi
 else
        save_patch=$patch
        if ! patch=$(find_patch $patch)
Index: bash_completion
===================================================================
RCS file: /cvsroot/quilt/quilt/bash_completion,v
retrieving revision 1.14
diff -u -r1.14 bash_completion
--- bash_completion     12 Jun 2005 12:37:56 -0000      1.14
+++ bash_completion     12 Jun 2005 17:09:26 -0000
@@ -135,7 +135,7 @@
           COMPREPLY=( $( compgen -W "-h $(quilt applied)" -- $cur ) )
           ;;
        delete) 
-          COMPREPLY=( $( compgen -W "-h $(quilt series)" -- $cur ) )
+          COMPREPLY=( $( compgen -W "-n -h $(quilt series)" -- $cur ) )
           ;;
        diff) 
           case $prev in
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to