From c2993a84cc93ea9561a45a62b44e5f796968160b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 5 Mar 2006 09:42:42 +0000 Subject: - quilt/import.in: Fix replacement of compressed patches. - test/import2.test: New test case for compressed patches. --- po/de.po | 4 +- po/fr.po | 4 +- po/ja.po | 4 +- po/quilt.pot | 4 +- quilt.changes | 6 +++ quilt/import.in | 13 +++-- test/import2.test | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 165 insertions(+), 13 deletions(-) create mode 100644 test/import2.test diff --git a/po/de.po b/po/de.po index 0e2ad0d..55529dd 100644 --- a/po/de.po +++ b/po/de.po @@ -694,11 +694,11 @@ msgstr "Importiere patch %s\\n" msgid "Importing patch %s (stored as %s)\\n" msgstr "Importiere Patch %s (abgelegt als %s)\\n" -#: quilt/import.in:195 +#: quilt/import.in:198 msgid "Failed to import patch %s\\n" msgstr "Konnte Patch %s nicht importieren\\n" -#: quilt/import.in:204 +#: quilt/import.in:207 msgid "Failed to insert patch %s into file series\\n" msgstr "Konnte Patch %s nicht in die series-Datei einfügen\\n" diff --git a/po/fr.po b/po/fr.po index 3b3cc14..113c9a5 100644 --- a/po/fr.po +++ b/po/fr.po @@ -697,11 +697,11 @@ msgstr "Import du patch %s\\n" msgid "Importing patch %s (stored as %s)\\n" msgstr "Import du patch %s (enregistré dans %s)\\n" -#: quilt/import.in:195 +#: quilt/import.in:198 msgid "Failed to import patch %s\\n" msgstr "Impossible d'importer le patch %s\\n" -#: quilt/import.in:204 +#: quilt/import.in:207 msgid "Failed to insert patch %s into file series\\n" msgstr "Impossible d'inserer %s dans le fichier de série.\\n" diff --git a/po/ja.po b/po/ja.po index c87095b..f695bb2 100644 --- a/po/ja.po +++ b/po/ja.po @@ -672,11 +672,11 @@ msgstr "パッム%s ã‚’å–ã‚Šè¾¼ã¿ã¾ã™\\n" msgid "Importing patch %s (stored as %s)\\n" msgstr "パッム%s ã‚’å–り込んã§ã„ã¾ã™ (%s ã¨ã—ã¦ä¿å­˜ã•ã‚Œã¾ã™)\\n" -#: quilt/import.in:195 +#: quilt/import.in:198 msgid "Failed to import patch %s\\n" msgstr "パッム%s ã®å–ã‚Šè¾¼ã¿ã«å¤±æ•—ã—ã¾ã—ãŸ\\n" -#: quilt/import.in:204 +#: quilt/import.in:207 msgid "Failed to insert patch %s into file series\\n" msgstr "seriesファイルã¸ã®ãƒ‘ッム%s ã®æ›¸ãè¾¼ã¿ã«å¤±æ•—ã—ã¾ã—ãŸ\\n" diff --git a/po/quilt.pot b/po/quilt.pot index efe9859..541fc82 100644 --- a/po/quilt.pot +++ b/po/quilt.pot @@ -463,11 +463,11 @@ msgstr "" msgid "Importing patch %s (stored as %s)\\n" msgstr "" -#: quilt/import.in:195 +#: quilt/import.in:198 msgid "Failed to import patch %s\\n" msgstr "" -#: quilt/import.in:204 +#: quilt/import.in:207 msgid "Failed to insert patch %s into file series\\n" msgstr "" diff --git a/quilt.changes b/quilt.changes index 7242341..7ca70fb 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Mar 5 10:41:36 CET 2006 - khali@linux-fr.org + +- quilt/import.in: Fix replacement of compressed patches. +- test/import2.test: New test case for compressed patches. + ------------------------------------------------------------------- Thu Feb 16 09:06:01 CET 2006 - agruen@suse.de diff --git a/quilt/import.in b/quilt/import.in index 816ea9c..1584691 100644 --- a/quilt/import.in +++ b/quilt/import.in @@ -51,8 +51,8 @@ merge_patches() local old="$1" new="$2" local old_desc=$(gen_tempfile) new_desc=$(gen_tempfile) - cat "$old" | patch_header | strip_diffstat > $old_desc - cat "$new" | patch_header | strip_diffstat > $new_desc + cat_file "$old" | patch_header | strip_diffstat > $old_desc + cat_file "$new" | patch_header | strip_diffstat > $new_desc if [ -z "$opt_desc" ] then @@ -79,9 +79,9 @@ $"Please use -d {o|a|n} to specify which patch header(s) to keep.\n" >&2 [ "$opt_desc" = a ] && echo '---' if [ "$opt_desc" = o ] then - cat "$new" | patch_body + cat_file "$new" | patch_body else - cat "$new" + cat_file "$new" fi rm -f $old_desc $new_desc } @@ -190,7 +190,10 @@ do fi if [ "$merged_patch_file" != "$dest" ] && \ - ! cp "$merged_patch_file" "$dest" + (( [ "$merged_patch_file" != "$patch_file" ] && \ + ! cat_to_new_file "$dest" < "$merged_patch_file" ) || \ + ( [ "$merged_patch_file" = "$patch_file" ] && \ + ! cp "$merged_patch_file" "$dest" )) then printf $"Failed to import patch %s\n" "$(print_patch $patch)" >&2 die 1 diff --git a/test/import2.test b/test/import2.test new file mode 100644 index 0000000..af6a5fd --- /dev/null +++ b/test/import2.test @@ -0,0 +1,143 @@ +# same as import.test, but with compressed patches + + $ rm -rf d + $ mkdir -p d/patches + $ cd d + + $ 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 pop + > Removing patch %{P}patch1.diff + > Removing f + > + > No patches applied + + $ mkdir t + $ gzip < patches/patch1.diff > t/patch1.diff.gz + $ rm -f patches/patch1.diff + + # test importing into an empty series + $ rm -rf patches/ .pc/ + $ mkdir patches + $ quilt import t/patch1.diff.gz + > Importing patch t/patch1.diff.gz (stored as %{P}patch1.diff.gz) + + $ quilt push + > Applying patch %{P}patch1.diff.gz + >~ patching file `?f'? + > + > Now at patch %{P}patch1.diff.gz + + $ quilt new patch2.diff.gz + > Patch %{P}patch2.diff.gz is now on top + + $ quilt add g + > File g added to patch %{P}patch2.diff.gz + + $ echo g > g + + $ quilt refresh + > Refreshed patch %{P}patch2.diff.gz + + $ quilt pop + > Removing patch %{P}patch2.diff.gz + > Removing g + > + > Now at patch %{P}patch1.diff.gz + + $ quilt header -a + < original description + > Appended text to header of patch %{P}patch1.diff.gz + + $ quilt pop + > Removing patch %{P}patch1.diff.gz + > Removing f + > + > No patches applied + + $ quilt delete patch1 + > Removed patch %{P}patch1.diff.gz + + $ cat %{P}series + > patch2.diff.gz + + # test a few error cases + + $ quilt import missing.diff.gz + > Patch missing.diff.gz does not exist + + $ quilt import patches/patch1.diff.gz + > Importing patch %{P}patch1.diff.gz + + $ quilt import patches/patch2.diff.gz + > Patch %{P}patch2.diff.gz already exists in series. + + # a simple use of import + + $ quilt import t/patch1.diff.gz + > Patch %{P}patch1.diff.gz exists. Replace with -f. + + $ quilt import -f t/patch1.diff.gz + > Replacing patch %{P}patch1.diff.gz with new version + + # an import requiring a description merge + $ zcat patches/patch1.diff.gz | sed -e 's/original/new/' | gzip > t/patch1.diff.gz + $ quilt import t/patch1.diff.gz + > Patch %{P}patch1.diff.gz exists. Replace with -f. + + $ quilt import -f t/patch1.diff.gz + > Patch headers differ: + > @@ -1 +1 @@ + > -original description + > +new description + > Please use -d {o|a|n} to specify which patch header(s) to keep. + + $ quilt import -d a -f t/patch1.diff.gz + > Replacing patch %{P}patch1.diff.gz with new version + + # quilt header does not work in this case because it stops at '---' + $ zcat patches/patch1.diff.gz | head -n 3 + > original description + > --- + > new description + + $ quilt import -d n -f t/patch1.diff.gz + > Replacing patch %{P}patch1.diff.gz with new version + + $ quilt header patch1 + > new description + + $ quilt delete patch1 + > Removed patch %{P}patch1.diff.gz + + # make sure it accepts non-conflicting names + # a small presentation problem here + + $ cp patches/patch1.diff.gz t/patch1.patch.gz + $ quilt import t/patch1.patch.gz + > Importing patch t/patch1.patch.gz (stored as %{P}patch1.patch.gz) + + $ ls patches/ + > patch1.diff.gz + > patch1.patch.gz + > patch2.diff.gz + > series + + $ cat %{P}series + > patch1.patch.gz + > patch2.diff.gz + + $ quilt delete patch1.diff.gz + > Patch patch1.diff.gz is not in series + + $ cd .. + $ rm -rf d -- cgit