quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] [PATCH] Add a rename command


From: Andreas Gruenbacher
Subject: Re: [Quilt-dev] [PATCH] Add a rename command
Date: Wed, 8 Jun 2005 22:50:08 +0200
User-agent: KMail/1.8

Hi Jean,

I've added the patch, thanks. Some comments:

On Wednesday 08 June 2005 22:06, Jean Delvare wrote:
> +if ( is_applied $patch && \
> +     ( ! rename_in_db "$patch" "$new_patch" || \
> +       ! mv "$QUILT_PC/$patch" "$QUILT_PC/$new_patch" ) ) || \
> +   ! rename_in_series "$patch" "$new_patch" || \
> +   ( [ -e "$(patch_file_name $patch)" ] && \
> +     ! mv "$(patch_file_name $patch)" \
> +       "$(patch_file_name $new_patch)" )

This will fail when new_patch contains new path components, like:

  quilt rename -p old.diff newdir/new.diff

> --- /dev/null 2005-06-08 20:05:55.000000000 +0200
> +++ test/rename.test  2005-06-08 21:25:23.000000000 +0200
> @@ -0,0 +1,69 @@
> +     $ mkdir d
> +     $ cd d
> +
> +     $ cat > announce.txt
> +     < A short summary of the fixes are below.
> +
> +     $ quilt new original-name.diff
> +     > Patch %{P}original-name.diff is now on top
> +
> +     $ quilt add announce.txt
> +     > File announce.txt added to patch %{P}original-name.diff
> +
> +     $ cat > announce.txt
> +     < The diffstat and short summary of the fixes are below.
> +
> +     $ quilt refresh
> +     > Refreshed patch %{P}original-name.diff
> +
> +     $ quilt series -v
> +     > = %{P}original-name.diff
> +
> +     $ ls -1 .pc
> +     > applied-patches
> +     > original-name.diff

I would rather like to keep details like the .pc directory out of the test 
suite as far as possible: someone might use a different backend one day, and 
then those tests would fail. I think we are fine relying on the applied, 
series, etc. commands, and trying to pop/push the patch here should make sure 
enough that everything is fine here, no?

ls also fails for me here because the order in which files are returned 
differs.

I assume you are fine with these changes?

Index: quilt/rename.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/rename.in,v
retrieving revision 1.1
diff -u -r1.1 rename.in
--- quilt/rename.in     8 Jun 2005 20:40:54 -0000       1.1
+++ quilt/rename.in     8 Jun 2005 20:48:55 -0000
@@ -89,9 +89,11 @@
 
 if ( is_applied $patch && \
      ( ! rename_in_db "$patch" "$new_patch" || \
+       ! mkdir -p "$(dirname "$new_patch")" || \
        ! mv "$QUILT_PC/$patch" "$QUILT_PC/$new_patch" ) ) || \
    ! rename_in_series "$patch" "$new_patch" || \
    ( [ -e "$(patch_file_name $patch)" ] && \
+     ! mkdir -p "$(dirname "$(patch_file_name $new_patch)")" || \
      ! mv "$(patch_file_name $patch)" \
          "$(patch_file_name $new_patch)" )
 then
Index: test/rename.test
===================================================================
RCS file: /cvsroot/quilt/quilt/test/rename.test,v
retrieving revision 1.1
diff -u -r1.1 rename.test
--- test/rename.test    8 Jun 2005 20:40:54 -0000       1.1
+++ test/rename.test    8 Jun 2005 20:48:55 -0000
@@ -19,26 +19,12 @@
        $ quilt series -v
        > = %{P}original-name.diff
 
-       $ ls -1 .pc
-       > applied-patches
-       > original-name.diff
-
-       $ cat .pc/applied-patches
-       > original-name.diff
-
        $ quilt rename _tmp_name.diff
        > Patch %{P}original-name.diff renamed to %{P}_tmp_name.diff
 
        $ quilt series -v
        > = %{P}_tmp_name.diff
 
-       $ ls -1 .pc
-       > _tmp_name.diff
-       > applied-patches
-
-       $ cat .pc/applied-patches
-       > _tmp_name.diff
-
        $ quilt pop
        > Removing patch %{P}_tmp_name.diff
        > Restoring announce.txt
@@ -48,8 +34,6 @@
        $ quilt series -v
        >   %{P}_tmp_name.diff
 
-       $ ls -1 .pc
-
        $ quilt rename -p random_name.diff final.name.diff
        > Patch random_name.diff is not in series
 
@@ -59,11 +43,19 @@
        $ quilt rename -p _tmp_name.diff _tmp_name.diff
        > Patch %{P}_tmp_name.diff exists already, please choose a different 
name
 
-       $ quilt rename -p _tmp_name.diff final.name.diff
-       > Patch %{P}_tmp_name.diff renamed to %{P}final.name.diff
+       $ quilt rename -p _tmp_name.diff newsubdir/final.name.diff
+       > Patch %{P}_tmp_name.diff renamed to %{P}newsubdir/final.name.diff
 
        $ quilt series -v
-       >   %{P}final.name.diff
+       >   %{P}newsubdir/final.name.diff
+
+       $ quilt push -q
+       > Applying patch %{P}newsubdir/final.name.diff
+       > Now at patch %{P}newsubdir/final.name.diff
+
+       $ quilt pop -q
+       > Removing patch %{P}newsubdir/final.name.diff
+       > No patches applied
 
        $ cd ..
        $ rm -rf d

Thanks,
Andreas.




reply via email to

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