quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] fix patch version check in configure.ac


From: Gary V. Vaughan
Subject: Re: [Quilt-dev] fix patch version check in configure.ac
Date: Wed, 01 Feb 2006 11:39:08 +0000
User-agent: Thunderbird 1.5 (X11/20051201)

Andreas Gruenbacher wrote:
> Hello Gary,

Hallo!

> On Friday 27 January 2006 03:30, Gary V. Vaughan wrote:
>> Andreas Gruenbacher wrote:
>>> On Thursday 26 January 2006 16:22, Gary V. Vaughan wrote:
>>>> I'll generate a patch after the release.
>>> Why not do it now? There's still enough time left.
>> Okay.  Attached.  The tests are adjusted to use the newly consistent
>> -P syntax too.  I'm off to Holland until Sunday evening now, so
>> apologies if I drop off the net until then...
> 
> we obviously were in a little misunderstanding here: I assumed you were 
> talking only about unifying the existing options, while the patch converts 
> all patch arguments to options as well (e.g., "quilt push some-patch" would 
> become "quilt push -P some-patch"). Interestingly, you did not change "quilt 
> push 5" to "quilt push -N 5" or similar.

Yes, sorry, I was rushing to get the patch finished before leaving to catch
my flight.

> I see an advantage to always being able to specify a patch with -P when in 
> doubt. I also see an advantage in not having to specify -P for those commands 
> that don't require it right now though: with those commands, a  patch name is 
> the parameter that makes the most sense, at least IMHO. People also sure have 
> grown very used to how many of those commands work.

ACK.

> We could also allow to specify those patch arguments with a -P option as an 
> alternative for those cases where a user is unsure, but I'm not sure that 
> this wouldn't create more confusion than it's worth. The affected commands 
> are: applied, delete, files, graph, header, next, pop, previous, push, 
> refresh, unapplied.

Agreed.  Actually, it is only a few extra lines of code to make the -P
optional and support both the guys who are learning quilt and like the
consistency of being able to use -P everywhere, and the guys who have
learnt quilt and want to save themselves a few keystrokes on each command.

Attached is a revised patch against head that implements this for the
remaining quilt commands.  I've also made push and pop accept an optional
-N for numeric arguments in light of your suggestion above.

I'd be happy for this to go in after 0.43, since it is just a UI
convenience...

Cheers,
        Gary.
-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
 quilt/applied.in   |   20 ++++++++++++++++----
 quilt/delete.in    |   22 +++++++++++++++++-----
 quilt/files.in     |   24 ++++++++++++++++++------
 quilt/graph.in     |   24 +++++++++++++++++++-----
 quilt/header.in    |   20 ++++++++++++++++----
 quilt/next.in      |   20 ++++++++++++++++----
 quilt/pop.in       |   31 ++++++++++++++++++++++++++++---
 quilt/previous.in  |   20 ++++++++++++++++----
 quilt/push.in      |   31 ++++++++++++++++++++++++++++---
 quilt/refresh.in   |   24 ++++++++++++++++++------
 quilt/unapplied.in |   22 +++++++++++++++++-----
 11 files changed, 209 insertions(+), 49 deletions(-)

Index: quilt-HEAD/quilt/applied.in
===================================================================
--- quilt-HEAD.orig/quilt/applied.in
+++ quilt-HEAD/quilt/applied.in
@@ -19,12 +19,15 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt applied [patch]\n"
+       printf $"Usage: quilt applied [[-P] patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
 Print a list of applied patches, or all patches up to and including the
 specified patch in the file series.
+
+-P patch
+       Print all patches up to and including the specified patch.
 "
                exit 0
        else
@@ -32,7 +35,7 @@ specified patch in the file series.
        fi
 }
 
-options=`getopt -o nh -- "$@"`
+options=`getopt -o P:nh -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -44,6 +47,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -h)
                usage -h ;;
        --)
@@ -52,12 +58,18 @@ do
        esac
 done
 
-if [ $# -gt 1 ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
 fi
 
-patch=$(find_applied_patch "$1") || exit 1
+patch=$(find_applied_patch "$opt_patch") || exit 1
 
 for patch in $(applied_before "$patch") $patch
 do
Index: quilt-HEAD/quilt/delete.in
===================================================================
--- quilt-HEAD.orig/quilt/delete.in
+++ quilt-HEAD/quilt/delete.in
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt delete [-r] [--backup] [patch|-n]\n"
+       printf $"Usage: quilt delete [-r] [--backup] [[-P] patch|-n]\n"
        if [ x$1 = x-h ]
        then
                printf $"
@@ -27,6 +27,9 @@ Remove the specified or topmost patch fr
 patch is applied, quilt will attempt to remove it first. (Only the
 topmost patch can be removed right now.)
 
+-P patch
+        Delete the named patch.
+
 -n     Delete the next patch after topmost, rather than the specified
        or topmost patch.
 
@@ -43,7 +46,7 @@ topmost patch can be removed right now.)
        fi
 }
 
-options=`getopt -o nrh --long backup -- "$@"`
+options=`getopt -o P:nrh --long backup -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -55,6 +58,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -n)
                opt_next=1
                shift ;;
@@ -72,13 +78,19 @@ do
        esac
 done
 
-if [ $# -gt 1 -o \( -n "$opt_next" -a $# -gt 0 \) ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
 fi
 
-if [ -n "$1" ]; then
-       patch=$(find_patch "$1") || exit 1
+if [ -n "$opt_patch" ]; then
+       patch=$(find_patch "$opt_patch") || exit 1
 else
        patch=$(top_patch)
 fi
Index: quilt-HEAD/quilt/files.in
===================================================================
--- quilt-HEAD.orig/quilt/files.in
+++ quilt-HEAD/quilt/files.in
@@ -19,12 +19,15 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt files [-v] [-a] [-l] [--combine patch] [patch]\n"
+       printf $"Usage: quilt files [-v] [-l] [-a | [-P] patch | --combine 
patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
 Print the list of files that the topmost or specified patch changes.
 
+-P patch
+       List the files in specified patch.
+
 -a     List all files in all applied patches.
 
 -l     Add patch name to output.
@@ -43,7 +46,7 @@ Print the list of files that the topmost
        fi
 }
 
-options=`getopt -o vhal --long combine: -- "$@"`
+options=`getopt -o P:vhal --long combine: -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -55,17 +58,20 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -v)
                opt_verbose=1
                shift ;;
        -a)
                opt_all=1
                shift ;;
+       -h)
+               usage -h ;;
        -l)
                opt_labels=1
                shift ;;
-       -h)
-               usage -h ;;
        --combine)
                opt_all=1
                if [ "$2" = - ]
@@ -81,12 +87,18 @@ do
        esac
 done
 
-if [ $# -gt 1 ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
 fi
 
-last_patch=$(find_applied_patch "$1") || exit 1
+last_patch=$(find_applied_patch "$opt_patch") || exit 1
 
 if [ -n "$opt_all" -a -z "$first_patch" ]
 then
Index: quilt-HEAD/quilt/graph.in
===================================================================
--- quilt-HEAD.orig/quilt/graph.in
+++ quilt-HEAD/quilt/graph.in
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt graph [--all] [--reduce] [--lines[=num]] 
[--edge-labels=files] [-T ps] [patch]\n"
+       printf $"Usage: quilt graph [--all] [--reduce] [--lines[=num]] 
[--edge-labels=files] [-T ps] [[-P] patch]\n"
 
        if [ x$1 = x-h ]
        then
@@ -49,6 +49,9 @@ patch.
        Label graph edges with the file names that the adjacent patches
        modify.
 
+-P patch
+       Create a graph for specified patch.
+
 -T ps  Directly produce a PostScript output file.
 "
                exit 0
@@ -57,7 +60,7 @@ patch.
        fi
 }
 
-options=`getopt -o T:h --long all,reduce,lines::,edge-labels: -- "$@"`
+options=`getopt -o P:T:h --long all,reduce,lines::,edge-labels: -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -69,7 +72,12 @@ eval set -- "$options"
 while true
 do
        case "$1" in
-       -T)     if [ "$2" != ps ]; then
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
+
+       -T)
+               if [ "$2" != ps ]; then
                        usage
                fi
                opt_format=ps
@@ -104,14 +112,20 @@ do
        esac
 done
 
-if [ $# -gt 1 -o \( $# -ne 0 -a -n "$opt_all" \) ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 -o -z "$opt_patch$opt_all" ]
 then
        usage
 fi
 
 if [ -z "$opt_all" ]
 then
-       patch=$(find_applied_patch "$1") || exit 1
+       patch=$(find_applied_patch "$opt_patch") || exit 1
 fi
 
 options=
Index: quilt-HEAD/quilt/header.in
===================================================================
--- quilt-HEAD.orig/quilt/header.in
+++ quilt-HEAD/quilt/header.in
@@ -21,13 +21,16 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] 
[--strip-trailing-whitespace] [patch]\n"
+       printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] 
[--strip-trailing-whitespace] [[-P] patch]\n"
 
        if [ x$1 = x-h ]
        then
                printf $"
 Print or change the header of the topmost or specified patch.
 
+-P patch
+       Change the header of the specified patch.
+
 -a, -r, -e
        Append to (-a) or replace (-r) the exiting patch header, or
        edit (-e) the header in \$EDITOR (%s). If none of these options is
@@ -68,7 +71,7 @@ maybe_strip_diffstat()
        fi
 }
 
-options=`getopt -o areh --long backup,strip-trailing-whitespace,strip-diffstat 
-- "$@"`
+options=`getopt -o P:areh --long 
backup,strip-trailing-whitespace,strip-diffstat -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -80,6 +83,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -a)
                opt_append=1
                shift ;;
@@ -106,18 +112,24 @@ do
        esac
 done
 
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
 case "$opt_append$opt_replace$opt_edit"
 in
 ''|1)  ;;
 *)     usage ;;
 esac
 
-if [ $# -gt 1 ]
+if [ $# -gt 0 ]
 then
        usage
 fi
 
-patch=$(find_patch_in_series "$1") || exit 1
+patch=$(find_patch_in_series "$opt_patch") || exit 1
 
 patch_file=$(patch_file_name $patch)
 
Index: quilt-HEAD/quilt/next.in
===================================================================
--- quilt-HEAD.orig/quilt/next.in
+++ quilt-HEAD/quilt/next.in
@@ -19,12 +19,15 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt next [patch]\n"
+       printf $"Usage: quilt next [[-P] patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
 Print the name of the next patch after the specified or topmost patch in
 the series file.
+
+-P patch
+       Print the name of the patch after this patch.
 "
                exit 0
        else
@@ -32,7 +35,7 @@ the series file.
        fi
 }
 
-options=`getopt -o h -- "$@"`
+options=`getopt -o P:h -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -44,6 +47,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -h)
                usage -h ;;
        --)
@@ -52,12 +58,18 @@ do
        esac
 done
 
-if [ $# -gt 1 ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
 fi
 
-next=$(find_unapplied_patch "$1") || exit
+next=$(find_unapplied_patch "$opt_patch") || exit
 
 if [ -n "$next" ]
 then
Index: quilt-HEAD/quilt/pop.in
===================================================================
--- quilt-HEAD.orig/quilt/pop.in
+++ quilt-HEAD/quilt/pop.in
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt pop [-afRqv] [num|patch]\n"
+       printf $"Usage: quilt pop [-afRqv] [[-N] num|[-P] patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
@@ -30,6 +30,11 @@ patches until the specified patch end up
 names may include the patches/ prefix, which means that filename
 completion can be used.
 
+-N num  Remove the specified number of patches.
+
+-P patch
+       Remove patches above specified patch.
+
 -a     Remove all applied patches.
 
 -f     Force remove. The state before the patch(es) were applied will
@@ -177,7 +182,7 @@ remove_patch()
        return $status
 }
 
-options=`getopt -o fRqvah -- "$@"`
+options=`getopt -o N:P:fRqvah -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -189,6 +194,12 @@ eval set -- "$options"
 while true
 do
         case "$1" in
+       -N)
+               number="$2"
+               shift 2 ;;
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
         -f)
                 opt_force=1
                unset opt_remove
@@ -214,6 +225,12 @@ do
         esac
 done
 
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
 if [ $# -gt 1 -o \( -n "$opt_all" -a $# -ne 0 \) ]
 then
         usage
@@ -224,9 +241,17 @@ then
        if is_numeric $1
        then
                number=$1
+       elif [ -z "$opt_patch" ]
+       then
+               opt_patch="$1"
        else
-               stop_at_patch=$(find_applied_patch "$1") || exit 1
+               usage
        fi
+fi
+
+if [ -n "$opt_patch" ]
+then
+        stop_at_patch=$(find_applied_patch "$opt_patch") || exit 1
 else
        [ -n "$opt_all" ] || number=1
 fi
Index: quilt-HEAD/quilt/previous.in
===================================================================
--- quilt-HEAD.orig/quilt/previous.in
+++ quilt-HEAD/quilt/previous.in
@@ -19,12 +19,15 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt previous [patch]\n"
+       printf $"Usage: quilt previous [[-P] patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
 Print the name of the previous patch before the specified or topmost
 patch in the series file.
+
+-P patch
+       Print the name of the patch before this specified patch.
 "
                exit 0
        else
@@ -32,7 +35,7 @@ patch in the series file.
        fi
 }
 
-options=`getopt -o h -- "$@"`
+options=`getopt -o P:h -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -44,6 +47,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -h)
                usage -h ;;
        --)
@@ -52,12 +58,18 @@ do
        esac
 done
 
-if [ $# -gt 1 ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
 fi
 
-patch=$(find_patch_in_series "$1") || exit 1
+patch=$(find_patch_in_series "$opt_patch") || exit 1
 
 previous=$(applied_before "$patch" | tail -n 1)
 if [ -n "$previous" ]
Index: quilt-HEAD/quilt/push.in
===================================================================
--- quilt-HEAD.orig/quilt/push.in
+++ quilt-HEAD/quilt/push.in
@@ -21,7 +21,7 @@ setup_colors
 
 usage()
 {
-       printf $"Usage: quilt push [-afqv] [--leave-rejects] [--interactive] 
[--color[=always|auto|never]] [num|patch]\n"
+       printf $"Usage: quilt push [-afqv] [--leave-rejects] [--interactive] 
[--color[=always|auto|never]] [[-N] num|[-P] patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
@@ -32,6 +32,11 @@ all patches up to and including the spec
 include the patches/ prefix, which means that filename completion can
 be used.
 
+-N num Apply the specified number of patches from the series file.
+
+-P patch
+       Apply all patches up to and including this specified patch.
+
 -a     Apply all patches in the series file.
 
 -f     Force apply, even if the patch has rejects.
@@ -270,7 +275,7 @@ list_patches()
        fi
 }
 
-options=`getopt -o fqvah --long leave-rejects,interactive,color:: -- "$@"`
+options=`getopt -o N:P:fqvah --long leave-rejects,interactive,color:: -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -282,6 +287,12 @@ eval set -- "$options"
 while true
 do
         case "$1" in
+       -N)
+               number="$2"
+               shift 2;;
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
         -f)
                 opt_force=1
                shift ;;
@@ -321,6 +332,12 @@ do
         esac
 done
 
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
 if [ $# -gt 1 -o \( -n "$opt_all" -a $# -ne 0 \) ]
 then
         usage
@@ -331,9 +348,17 @@ then
        if is_numeric $1
        then
                number=$1
+       elif [ -z "$opt_patch" ]
+       then
+               opt_patch="$1"
        else
-               stop_at_patch="$1"
+               usage
        fi
+fi
+
+if [ -n "$opt_patch" ]
+then
+       stop_at_patch="$opt_patch"
 else
        [ -z "$opt_all" ] && number=1
 fi
Index: quilt-HEAD/quilt/refresh.in
===================================================================
--- quilt-HEAD.orig/quilt/refresh.in
+++ quilt-HEAD/quilt/refresh.in
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt refresh [-p n] [-u|-U num|-c|-C num] [-f] 
[--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] 
[--strip-trailing-whitespace] [patch]\n"
+       printf $"Usage: quilt refresh [-p n] [-u|-U num|-c|-C num] [-f] 
[--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] 
[--strip-trailing-whitespace] [[-P] patch]\n"
 
        if [ x$1 = x-h ]
        then
@@ -36,6 +36,9 @@ recent patches will be ignored, and only
 been modified by any more recent patches will end up in the specified
 patch.
 
+-P patch
+       Refresh this specific patch.
+
 -p n   Create a -p n style patch (-p0 or -p1 supported).
 
 -u, -U num, -c, -C num
@@ -78,9 +81,9 @@ die()
        exit $status
 }
 
-options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup,sort \
-                             --long no-index \
-                             --long strip-trailing-whitespace -- "$@"`
+options=`getopt -o P:p:uU:cC:fh --long no-timestamps,diffstat,backup,sort \
+                               --long no-index \
+                               --long strip-trailing-whitespace -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -93,6 +96,9 @@ opt_format=-u
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -p)
                opt_strip_level=$2
                shift 2 ;;
@@ -131,14 +137,20 @@ do
        esac
 done
 
-if [ $# -gt 1 ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
 fi
 
 QUILT_DIFF_OPTS="$QUILT_DIFF_OPTS $opt_format"
 
-patch=$(find_applied_patch "$1") || exit 1
+patch=$(find_applied_patch "$opt_patch") || exit 1
 
 if [ -z "$opt_strip_level" ]
 then
Index: quilt-HEAD/quilt/unapplied.in
===================================================================
--- quilt-HEAD.orig/quilt/unapplied.in
+++ quilt-HEAD/quilt/unapplied.in
@@ -19,12 +19,15 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt unapplied [patch]\n"
+       printf $"Usage: quilt unapplied [[-P] patch]\n"
        if [ x$1 = x-h ]
        then
                printf $"
 Print a list of patches that are not applied, or all patches that follow
 the specified patch in the series file.
+
+-P patch
+       Print all patches that follow this one.
 "
                exit 0
        else
@@ -32,7 +35,7 @@ the specified patch in the series file.
        fi
 }
 
-options=`getopt -o h -- "$@"`
+options=`getopt -o P:h -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -44,6 +47,9 @@ eval set -- "$options"
 while true
 do
        case "$1" in
+       -P)
+               opt_patch="$2"
+               shift 2 ;;
        -h)
                usage -h ;;
        --)
@@ -52,12 +58,18 @@ do
        esac
 done
 
-if [ $# -gt 1 ]
+if [ -z "$opt_patch" -a $# -gt 0 ]
+then
+       opt_patch="$1"
+       shift
+fi
+
+if [ $# -gt 0 ]
 then
        usage
-elif [ $# -eq 1 ]
+elif [ -n "$opt_patch" ]
 then
-       start=$(find_patch_in_series "$1") || exit 1
+       start=$(find_patch_in_series "$opt_patch") || exit 1
        patch=$(patch_after "$start")
 
        [ -n "$start" -a -z "$patch" ] && exit

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]