Hi,

when using subdirectories below QUILT_PATCHES it may be usefull to
just specify the subdirectory, which avoids specifying the patch name
a 2nd time.  E. g.:

  $ quilt import -P patches.fixes foo.diff
  Importing patch patches.fixes/foo.diff

Which avoids some typing.

The attached patch also changes the english help text, as well as the
test enviroment.  But I'm not sure whether the changes to quilt.pot
are all correct.

Any comments welcome.

 /Holger

import: support -P with subdirectory

So it is now possible to directly import into a patches subdirectory
with the same name:

 $ quilt import -P subdir foo.diff
 Importing patch subdir/foo.diff

Signed-off-by: Holger Eitzenberger <[email protected]>

Index: quilt/quilt/import.in
===================================================================
--- quilt.orig/quilt/import.in	2012-11-19 13:36:47.000000000 +0100
+++ quilt/quilt/import.in	2012-11-27 16:33:17.000000000 +0100
@@ -19,7 +19,7 @@
 
 usage()
 {
-	printf $"Usage: quilt import [-p num] [-R] [-P patch] [-f] [-d {o|a|n}] patchfile ...\n"
+	printf $"Usage: quilt import [-p num] [-R] [-P patch|directory] [-f] [-d {o|a|n}] patchfile ...\n"
 	if [ x$1 = x-h ]
 	then
 		printf $"
@@ -32,9 +32,10 @@
 -R
 	Apply patch in reverse.
 
--P patch
-	Patch filename to use inside quilt. This option can only be
-	used when importing a single patch.
+-P patch|directory
+	Patch filename to use inside quilt, or subdirectory below patch
+	directory where to store patch. This option can only be used
+	when importing a single patch.
 
 -f	Overwrite/update existing patches.
 
@@ -156,7 +157,12 @@
 do
 	if [ -n "$opt_patch" ]
 	then
-		patch=$opt_patch
+		if [ -d "$QUILT_PATCHES/$opt_patch" ];
+		then
+			patch="$opt_patch/${orig_patch_file##*/}"
+		else
+			patch=$opt_patch
+		fi
 	else
 		patch=${orig_patch_file##*/}
 	fi
Index: quilt/test/import.test
===================================================================
--- quilt.orig/test/import.test	2012-11-19 13:36:47.000000000 +0100
+++ quilt/test/import.test	2012-11-27 16:00:48.000000000 +0100
@@ -255,3 +255,30 @@
 	> Importing patch ../empty.patch (stored as ../patches/empty.patch)
 	$ quilt import %{PWD}/empty2.patch
 	> Importing patch %{PWD}/empty2.patch (stored as ../patches/empty2.patch)
+
+# Import into subdirectory
+	$ rm -rf patches/ .pc/ f
+	$ mkdir -p patches/subdir
+
+	$ quilt new patch1.diff
+	> Patch %{P}patch1.diff is now on top
+
+	$ quilt add f
+	> File f added to patch %{P}patch1.diff
+
+	$ echo f > f
+
+	$ quilt refresh
+	> Refreshed patch %{P}patch1.diff
+
+	$ quilt delete patch1
+	> Removing patch patches/patch1.diff
+	> No patches applied
+	> Removed patch patches/patch1.diff
+
+	$ mkdir t
+	$ mv patches/patch1.diff t/patch1.diff
+
+	$ quilt import -P subdir t/patch1.diff
+	> Importing patch t/patch1.diff (stored as patches/subdir/patch1.diff)
+
Index: quilt/po/quilt.pot
===================================================================
--- quilt.orig/po/quilt.pot	2012-11-19 13:36:47.000000000 +0100
+++ quilt/po/quilt.pot	2012-11-27 16:37:04.000000000 +0100
@@ -409,8 +409,8 @@
 
 #: quilt/import.in:22
 msgid ""
-"Usage: quilt import [-p num] [-R] [-P patch] [-f] [-d {o|a|n}] patchfile ..."
-"\\n"
+"Usage: quilt import [-p num] [-R] [-P patch|directory] [-f] [-d {o|a|n}] "
+"patchfile ...\\n"
 msgstr ""
 
 #: quilt/import.in:25
@@ -425,9 +425,10 @@
 "-R\n"
 "\tApply patch in reverse.\n"
 "\n"
-"-P patch\n"
-"\tPatch filename to use inside quilt. This option can only be\n"
-"\tused when importing a single patch.\n"
+"-P patch|directory\n"
+"\tPatch filename to use inside quilt, or subdirectory below patch\n"
+"\tdirectory where to store patch. This option can only be used\n"
+"\twhen importing a single patch.\n"
 "\n"
 "-f\tOverwrite/update existing patches.\n"
 "\n"
@@ -437,47 +438,47 @@
 "\tmust be specified. This option is only effective when -f is used.\n"
 msgstr ""
 
-#: quilt/import.in:71
+#: quilt/import.in:72
 msgid "Patch headers differ:\\n"
 msgstr ""
 
-#: quilt/import.in:74
+#: quilt/import.in:75
 msgid "Please use -d {o|a|n} to specify which patch header(s) to keep.\\n"
 msgstr ""
 
-#: quilt/import.in:139
+#: quilt/import.in:140
 msgid "Option \\`-P' can only be used when importing a single patch\\n"
 msgstr ""
 
-#: quilt/import.in:169
+#: quilt/import.in:175
 msgid "Patch %s is applied\\n"
 msgstr ""
 
-#: quilt/import.in:178
+#: quilt/import.in:184
 msgid "Patch %s already exists in series.\\n"
 msgstr ""
 
-#: quilt/import.in:184
+#: quilt/import.in:190
 msgid "Patch %s exists. Replace with -f.\\n"
 msgstr ""
 
-#: quilt/import.in:195
+#: quilt/import.in:201
 msgid "Replacing patch %s with new version\\n"
 msgstr ""
 
-#: quilt/import.in:199
+#: quilt/import.in:205
 msgid "Importing patch %s\\n"
 msgstr ""
 
-#: quilt/import.in:201
+#: quilt/import.in:207
 msgid "Importing patch %s (stored as %s)\\n"
 msgstr ""
 
-#: quilt/import.in:214
+#: quilt/import.in:220
 msgid "Failed to import patch %s\\n"
 msgstr ""
 
-#: quilt/import.in:223 quilt/refresh.in:333
+#: quilt/import.in:229 quilt/refresh.in:333
 msgid "Failed to insert patch %s into file series\\n"
 msgstr ""
 
@@ -1049,21 +1050,21 @@
 "-v\tVerbose, more user friendly output.\n"
 msgstr ""
 
-#: quilt/setup.in:31
+#: quilt/setup.in:34 quilt/setup.in:53
 msgid "Directory %s exists\\n"
 msgstr ""
 
-#: quilt/setup.in:37
+#: quilt/setup.in:59
 msgid "File %s exists\\n"
 msgstr ""
 
-#: quilt/setup.in:75
+#: quilt/setup.in:99
 msgid ""
 "Usage: quilt setup [-d path-prefix] [-v] [--sourcedir dir] [--fuzz=N] "
 "{specfile|seriesfile}\\n"
 msgstr ""
 
-#: quilt/setup.in:78
+#: quilt/setup.in:102
 msgid ""
 "\n"
 "Initializes a source tree from an rpm spec file or a quilt series file.\n"
@@ -1079,19 +1080,19 @@
 "\tSet the maximum fuzz factor (needs rpm 4.6 or later).\n"
 msgstr ""
 
-#: quilt/setup.in:149
+#: quilt/setup.in:173
 msgid "The %%prep section of %s failed; results may be incomplete\\n"
 msgstr ""
 
-#: quilt/setup.in:152
+#: quilt/setup.in:176
 msgid "The -v option will show rpm's output\\n"
 msgstr ""
 
-#: quilt/setup.in:195
+#: quilt/setup.in:228 quilt/setup.in:240
 msgid "File %s not found\\n"
 msgstr ""
 
-#: quilt/setup.in:198
+#: quilt/setup.in:231 quilt/setup.in:243
 msgid "Unpacking archive %s\\n"
 msgstr ""
 
_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to