Hi Randy,

Sorry for the late answer.

On Sun, 3 Dec 2006 21:39:16 -0800, Randy Dunlap wrote:
> Hi,
> 
> I needed 'quilt import -R' recently and noticed that it is
> listed in the TODO file.

This is an interesting feature I have often been missing myself, it
would indeed be nice to implement it.

> This is likely missing something, so please tell me what it is.
> It works, but I had to specify -p1 also, instead of it being
> used as the normal default.  Anyone know why?

Not sure, maybe because of the issues below.

> 
> Thanks.
> ---
> 
> Add "-R" for "apply patch in reverse" to quilt "import".
> 
> ---
>  quilt/import.in |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> --- quilt-0.46.orig/quilt/import.in
> +++ quilt-0.46/quilt/import.in
> @@ -19,7 +19,7 @@ fi
>  
>  usage()
>  {
> -     printf $"Usage: quilt import [-p num] [-P patch] [-f] [-d {o|a|n}] 
> patchfile ...\n"
> +     printf $"Usage: quilt import [-p num] [-R] [-P patch] [-f] [-d {o|a|n}] 
> patchfile ...\n"
>       if [ x$1 = x-h ]
>       then
>               printf $"
> @@ -29,6 +29,9 @@ current top patch, and must be pushed af
>  -p num
>       Number of directory levels to strip when applying (default=1)
>  
> +-R
> +     Apply patch in reverse.
> +
>  -P patch
>       Patch filename to use inside quilt. This option can only be
>       used when importing a single patch.
> @@ -93,7 +96,8 @@ die()
>       exit $status
>  }
>  
> -options=`getopt -o P:d:fp:h -- "$@"`
> +options=`getopt -o P:d:fRp:h -- "$@"`
> +opt_reverse=""
>  
>  if [ $? -ne 0 ]
>  then
> @@ -111,6 +115,9 @@ do
>       -p)
>               opt_strip=$2
>               shift 2 ;;
> +     -R)
> +             opt_reverse=$1
> +             shift ;;
>       -d)
>               case "$2" in
>                       o|n|a) opt_desc=$2 ;;
> @@ -135,6 +142,7 @@ then
>  fi
>  
>  [ -n "$opt_strip" ] && patch_args="-p$opt_strip"
> +patch_args=`expr "$patch_args $opt_reverse"`

What is the purpose of calling "expr" here? I don't get it, it doesn't
do anything as far as I can see. Anyway, quilt doesn't currently depend
on expr, so I'd rather avoid adding a new dependency.

Also, if neither -p nor -R have been used, you'll end up with " " (a
space) in patch_args. This isn't nice and it breaks the test suite. BTW
it would be nice to add a test case for the new -R option in the test
suite.

Can you please fix these problems and submit a new patch?

>  
>  for patch_file in "$@"
>  do

Thanks,
-- 
Jean Delvare


_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to