Quoting myself:
> 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.

Actually everything wasn't working fine due to a stupid logic error
causing "quilt delete" to behave like "quilt delete -n". So here comes a
fourth attempt... Sorry for the noise. Hopefully this one is correct at
last. Testers welcome ;)

While we're at it... Is "quilt delete" (deleting the top patch) supposed
to work? It keeps failing at me. I traced it down to the automatic
"quilt pop -qf" failing with message "No patch removed", but couldn't
figure out what was causing this. I got the same result when using quilt
0.40 so I'm pretty sure it's not related to my changes. There doesn't
seem to be a test case for this command. Manually poping and then
deleting the same patch works just fine.

Thanks,
-- 
Jean Delvare
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     13 Jun 2005 20:36:52 -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
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     13 Jun 2005 20:36:52 -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,10 +69,25 @@
 if [ -z "$patch" ]
 then
        patch="$(top_patch)"
-       if [ -z "$patch" ]
+       if [ -z "$opt_next" ]
        then
-               printf $"No patches applied\n" >&2
-               exit 1
+               if [ -z "$patch" ]
+               then
+                       printf $"No patches applied\n" >&2
+                       exit 1
+               fi
+       else
+               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
        fi
 else
        save_patch=$patch
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to