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 20:42:10 -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,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)