Hi all,

[Greg KH]
>  - let 'delete' work on the next patch in the series (the one not
>    yet applied) without having to remember what that filename of the
>    patch is.  Yeah, it's a minor nit...

[Tom Rini]
> I always do quilt delete `quilt next`, but a --next or something would
> be handy, and shouldn't be hard.

Would something in the lines of the attached patch be OK? "quilt delete
-n" will delete the patch next patch after the topmost. Works for me,
comments welcome.

There is some possible code refactoring between "delete" and "next" now,
maybe a next_patch() function in patchfns would be welcome?

I attached a second patch, which makes "quilt delete" print which patch
it successfully deleted. It helped me test my changes, and I now tend to
think it is a good thing to have (so that you can quicky find if you
have not been deleting the patch you were supposed to) so maybe it could
stay.

Thanks,
-- 
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     7 Jun 2005 17:20:17 -0000
@@ -19,13 +19,16 @@
 
 usage()
 {
-       printf $"Usage: quilt delete [patch]\n"
+       printf $"Usage: quilt delete [-n | patch]\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,17 @@
 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
 else
        save_patch=$patch
        if ! patch=$(find_patch $patch)
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     7 Jun 2005 17:20:17 -0000
@@ -87,9 +99,11 @@
                exit 1
        fi
 fi
-if ! remove_from_series $patch
+if remove_from_series $patch
 then
-       printf $"Failed to remove patch %s\n" "$patch" >&2
+       printf $"Removed patch %s\n" "$(print_patch $patch)"
+else
+       printf $"Failed to remove patch %s\n" "$(print_patch $patch)" >&2
 fi
 ### Local Variables:
 ### mode: shell-script
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to