quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] Submit patch: "quilt delete" invokes "quilt pop" incorrectly


From: Joe Green
Subject: [Quilt-dev] Submit patch: "quilt delete" invokes "quilt pop" incorrectly
Date: Fri, 12 Aug 2005 19:50:01 -0700
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

I've run into a couple of problems while playing around with the new "quilt delete" options I posted.

"quilt delete" by itself is supposed to delete the top patch, invoking "pop" to remove it first, but there are a few problems in the way delete calls pop:
  • Unlike the old rpatch function, "pop <patch>" doesn't mean to remove that patch, but only up to that patch.  "pop" alone removes the top patch, which is what's wanted.
  • Invoking "quilt pop" as "@QUILT@/pop" breaks gen_tempfile, which expects $0 to be something like "quilt pop", and REALLY doesn't like slashes.  Using the call formulation in bin/quilt.in solves this.
  • QUILT_COMMAND=delete is passed on to pop, which means pop picks up QUILT_DELETE_ARGS, which may not work.  Setting QUILT_COMMAND="" for the call to pop solves this.
The first patch attached ("quilt-delete_pop.patch") fixes just these issues, and quilt delete seems to work fine this way.

However, I got to thinking that it would be good to abstract away the magic used to invoke one quilt command from another to make sure it's done consistently and it's easy to change if necessary.  The second patch ("quilt-quilt_command.patch") adds a new patch function "quilt_command" to do this, and updates the delete and edit commands to use it.

One possible issue with this second patch is that I set QUILT_COMMAND="", which means that the command invoked will pick up no default arguments from QUILTRC.  This seems desirable to me, as it means the command will get only the arguments the calling command passes.  It would be easy enough to set QUILT_COMMAND so that the invoked command will pick up default arguments, though.

Let me know what you think.
-- 
Joe Green <address@hidden>
MontaVista Software, Inc.
Source: MontaVista Software, Inc. <address@hidden>
Type: Defect Fix
Disposition: submit to http://savannah.nongnu.org/projects/quilt

There are a number of problems with the way "quilt pop" is invoked from
"quilt delete":

  - Unlike the old rpatch function, "pop <patch>" doesn't mean to remove
    that patch, but only up to that patch.  "pop" alone removes the top
    patch, which is what's wanted.

  - Invoking "quilt pop" as "@QUILT@/pop" breaks gen_tempfile, which
    expects $0 to be something like "quilt pop", and REALLY doesn't like
    slashes.  Using the call formulation in bin/quilt.in solves this.

  - QUILT_COMMAND=delete is passed on to pop, which means pop picks up
    QUILT_DELETE_ARGS, which may not work.  Setting QUILT_COMMAND=""
    for the call to pop solves this.

Index: quilt-0.42/quilt/delete.in
===================================================================
--- quilt-0.42.orig/quilt/delete.in
+++ quilt-0.42/quilt/delete.in
@@ -101,7 +101,7 @@ fi
 if is_applied $patch
 then
        if [ "$patch" != "$(top_patch)" ] || \
-          ! @QUILT@/pop -fq "$patch"
+          ! QUILT_COMMAND= @BASH@ $BASH_OPTS -c ". @QUILT@/pop" "quilt pop" -fq
        then
                printf $"Patch %s is currently applied\n" \
                       "$(print_patch $patch)" >&2
Source: MontaVista Software, Inc. <address@hidden>
Type: Enhancement
Disposition: submit to http://savannah.nongnu.org/projects/quilt

Use a standard function "quilt_command" to invoke one quilt command from
another.

Index: quilt-0.42/quilt/delete.in
===================================================================
--- quilt-0.42.orig/quilt/delete.in
+++ quilt-0.42/quilt/delete.in
@@ -100,8 +100,7 @@ else
 fi
 if is_applied $patch
 then
-       if [ "$patch" != "$(top_patch)" ] || \
-          ! QUILT_COMMAND= @BASH@ $BASH_OPTS -c ". @QUILT@/pop" "quilt pop" -fq
+       if [ "$patch" != "$(top_patch)" ] || ! quilt_command pop -fq
        then
                printf $"Patch %s is currently applied\n" \
                       "$(print_patch $patch)" >&2
Index: quilt-0.42/quilt/edit.in
===================================================================
--- quilt-0.42.orig/quilt/edit.in
+++ quilt-0.42/quilt/edit.in
@@ -6,6 +6,17 @@
 #
 #  See the COPYING and AUTHORS files for more details.
 
+# Read in library functions
+if [ "$(type -t patch_file_name)" != function ]
+then
+       if ! [ -r @SCRIPTS@/patchfns ]
+       then
+               echo "Cannot read library @SCRIPTS@/patchfns" >&2
+               exit 1
+       fi
+       . @SCRIPTS@/patchfns
+fi
+
 : ${EDITOR:=vi}
 
 usage()
@@ -48,14 +59,14 @@ then
        usage
 fi
 
-bash -c ". @QUILT@/add" "quilt add" "$@"
+quilt_command add "$@"
 $EDITOR "$@"
 status=$?
 for file in "$@"
 do
        if ! [ -e "$file" ]
        then
-               bash -c ". @QUILT@/remove" "quilt remove" "$file"
+               quilt_command remove "$file"
                status=1
        fi
 done
Index: quilt-0.42/scripts/patchfns.in
===================================================================
--- quilt-0.42.orig/scripts/patchfns.in
+++ quilt-0.42/scripts/patchfns.in
@@ -753,6 +753,14 @@ setup_colors()
        eval $C
 }
 
+quilt_command ()
+{
+       local command=$1
+       shift
+
+       QUILT_COMMAND="" @BASH@ $BASH_OPTS -c ". @QUILT@/$command" "quilt 
$command" "$@"
+}
+
 #
 # If the working directory does not contain a $QUILT_PATCHES directory,
 # quilt searches for its base directory up the directory tree. If no

reply via email to

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