diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | po/de.po | 39 | ||||
-rw-r--r-- | po/fr.po | 39 | ||||
-rw-r--r-- | po/ja.po | 39 | ||||
-rw-r--r-- | po/quilt.pot | 38 | ||||
-rw-r--r-- | quilt.changes | 7 | ||||
-rw-r--r-- | quilt/header.in | 11 | ||||
-rw-r--r-- | quilt/import.in | 65 | ||||
-rw-r--r-- | quilt/scripts/patchfns.in | 14 | ||||
-rw-r--r-- | test/import.test | 26 |
10 files changed, 208 insertions, 74 deletions
@@ -81,10 +81,6 @@ quilt import: - Add option to replace the currently applied patch with a new one, by backing out the topmost patch first. - - Diff -u the documentation of the old and new file, unless one - of them is empty. Let the user decide whether to keep the left - or the right documentation, or to merge them both. (-d{ona}?) - quilt setup: - Also recognize other uses of tar and patch (with options in the @@ -605,11 +605,11 @@ msgstr "" "--backup\n" "\tErzeuge eine Sicherungskopie von patch als patch~.\n" -#: quilt/header.in:176 +#: quilt/header.in:167 msgid "Replaced header of patch %s\\n" msgstr "Header von Patch %s ersetzt\\n" -#: quilt/header.in:179 +#: quilt/header.in:170 msgid "Appended text to header of patch %s\\n" msgstr "Text an Header von Patch %s angefügt\\n" @@ -618,6 +618,7 @@ msgid "Usage: quilt import [-f] [-p num] [-n patch] patchfile ...\\n" msgstr "Verwendung: quilt import [-f] [-p num] [-n patch] [patchdatei] ...\\n" #: quilt/import.in:25 +#, fuzzy msgid "" "\n" "Import external patches. The patches will be inserted following the\n" @@ -630,6 +631,10 @@ msgid "" "\tPatch filename to use inside quilt. This option can only be\n" "\tused when importing a single patch.\n" "\n" +"-d {o|a|n}\n" +"\tKeep the old (o), all (a), or new (n) description. This option\n" +"\tmust be specified if both patches include a description.\n" +"\n" "-f\tOverwite/update existing patches.\n" msgstr "" "\n" @@ -645,43 +650,51 @@ msgstr "" "\n" "-f\tÜberschreibe/aktualisiere existierende Patches.\n" -#: quilt/import.in:75 +#: quilt/import.in:67 +msgid "Patch headers differ:\\n" +msgstr "" + +#: quilt/import.in:70 +msgid "Please use -d {o|a|n} to specify which patch header(s) to keep.\\n" +msgstr "" + +#: quilt/import.in:123 msgid "Option \\`-n' can only be used when importing a single patch\\n" msgstr "" "Die Option \\`-n' kann nur beim Importieren eines einzelnen Patches " "verwendet werden\\n" -#: quilt/import.in:94 +#: quilt/import.in:143 msgid "Patch %s is applied\\n" msgstr "Patch %s ist angewandt\\n" -#: quilt/import.in:103 +#: quilt/import.in:152 #, fuzzy msgid "Patch %s already exists in series.\\n" msgstr "Patch %s ist nicht in der series-Datei\\n" -#: quilt/import.in:109 +#: quilt/import.in:158 msgid "Patch %s exists. Replace with -f.\\n" msgstr "Patch %s existiert bereits. Ersetzen mit -f.\\n" -#: quilt/import.in:113 +#: quilt/import.in:169 msgid "Replacing patch %s with new version\\n" msgstr "Ersetze Patch %s durch neuere Version\\n" -#: quilt/import.in:117 +#: quilt/import.in:173 #, fuzzy msgid "Importing patch %s\\n" msgstr "Entferne patch %s\\n" -#: quilt/import.in:119 +#: quilt/import.in:175 msgid "Importing patch %s (stored as %s)\\n" msgstr "Importiere Patch %s (abgelegt als %s)\\n" -#: quilt/import.in:128 +#: quilt/import.in:185 msgid "Failed to import patch %s\\n" msgstr "Konnte Patch %s nicht importieren\\n" -#: quilt/import.in:136 +#: quilt/import.in:192 msgid "Failed to insert patch %s into file series\\n" msgstr "Konnte Patch %s nicht in die series-Datei einfügen\\n" @@ -1234,7 +1247,7 @@ msgstr "series-Datei vollständig angewandt, endet in Patch %s\\n" msgid "Patch %s does not exist\\n" msgstr "Patch %s ist nicht in der series-Datei\\n" -#: quilt/scripts/patchfns.in:817 +#: quilt/scripts/patchfns.in:831 msgid "" "The quilt meta-data in this tree has version %s, but this version of quilt " "can only handle meta-data formats up to and including version %s. Please pop " @@ -1247,7 +1260,7 @@ msgstr "" "quilt alle Patches mit der Version von quilt, die zur Erstellung des " "Arbeitsverzeichnisses verwendet wurde.\\n" -#: quilt/scripts/patchfns.in:902 +#: quilt/scripts/patchfns.in:916 msgid "" "The working tree was created by an older version of quilt. Please run 'quilt " "upgrade'.\\n" @@ -609,11 +609,11 @@ msgstr "" "\tCre une sauvegarde de la version originale du patch en tant\n" "\tque patch~.\n" -#: quilt/header.in:176 +#: quilt/header.in:167 msgid "Replaced header of patch %s\\n" msgstr "En-tte du patch %s remplac\\n" -#: quilt/header.in:179 +#: quilt/header.in:170 msgid "Appended text to header of patch %s\\n" msgstr "Texte ajout la fin de l'en-tte du patch %s\\n" @@ -622,6 +622,7 @@ msgid "Usage: quilt import [-f] [-p num] [-n patch] patchfile ...\\n" msgstr "Usage : quilt import [-f] [-p num] [-n patch] fichier_de_patch ...\\n" #: quilt/import.in:25 +#, fuzzy msgid "" "\n" "Import external patches. The patches will be inserted following the\n" @@ -634,6 +635,10 @@ msgid "" "\tPatch filename to use inside quilt. This option can only be\n" "\tused when importing a single patch.\n" "\n" +"-d {o|a|n}\n" +"\tKeep the old (o), all (a), or new (n) description. This option\n" +"\tmust be specified if both patches include a description.\n" +"\n" "-f\tOverwite/update existing patches.\n" msgstr "" "\n" @@ -651,42 +656,50 @@ msgstr "" "\n" "-f\tcrase/met jour les patchs existants.\n" -#: quilt/import.in:75 +#: quilt/import.in:67 +msgid "Patch headers differ:\\n" +msgstr "" + +#: quilt/import.in:70 +msgid "Please use -d {o|a|n} to specify which patch header(s) to keep.\\n" +msgstr "" + +#: quilt/import.in:123 msgid "Option \\`-n' can only be used when importing a single patch\\n" msgstr "" "L'option -n ne peut tre utilis que lors de l'import d'un seul patch.\\n" -#: quilt/import.in:94 +#: quilt/import.in:143 msgid "Patch %s is applied\\n" msgstr "Le patch %s n'est pas appliqu\\n" -#: quilt/import.in:103 +#: quilt/import.in:152 #, fuzzy msgid "Patch %s already exists in series.\\n" msgstr "Le patch %s n'est pas dans la srie\\n" -#: quilt/import.in:109 +#: quilt/import.in:158 msgid "Patch %s exists. Replace with -f.\\n" msgstr "Le patch %s existe. Utilisez -f pour le remplacer.\\n" -#: quilt/import.in:113 +#: quilt/import.in:169 msgid "Replacing patch %s with new version\\n" msgstr "Remplacement du patch %s avec la nouvelle version\\n" -#: quilt/import.in:117 +#: quilt/import.in:173 #, fuzzy msgid "Importing patch %s\\n" msgstr "Retrait de %s\\n" -#: quilt/import.in:119 +#: quilt/import.in:175 msgid "Importing patch %s (stored as %s)\\n" msgstr "Import du patch %s (enregistr dans %s)\\n" -#: quilt/import.in:128 +#: quilt/import.in:185 msgid "Failed to import patch %s\\n" msgstr "Impossible d'importer le patch %s\\n" -#: quilt/import.in:136 +#: quilt/import.in:192 msgid "Failed to insert patch %s into file series\\n" msgstr "Impossible d'inserer %s dans le fichier de srie.\\n" @@ -1246,7 +1259,7 @@ msgstr "La srie est compltement applique. Le dernier patch est %s.\\n" msgid "Patch %s does not exist\\n" msgstr "Le patch %s n'est pas dans la srie\\n" -#: quilt/scripts/patchfns.in:817 +#: quilt/scripts/patchfns.in:831 msgid "" "The quilt meta-data in this tree has version %s, but this version of quilt " "can only handle meta-data formats up to and including version %s. Please pop " @@ -1258,7 +1271,7 @@ msgstr "" "format %s (inclus). Veuillez retirer vos patches avec la version \n" "utilise pour les appliquer avant d'installer une version plus ancienne.\\n" -#: quilt/scripts/patchfns.in:902 +#: quilt/scripts/patchfns.in:916 msgid "" "The working tree was created by an older version of quilt. Please run 'quilt " "upgrade'.\\n" @@ -587,11 +587,11 @@ msgstr "" "--backup\n" "\t古いバージョンのパッチのバックアップコピーを patch~として作成する。\n" -#: quilt/header.in:176 +#: quilt/header.in:167 msgid "Replaced header of patch %s\\n" msgstr "パッチ %s のヘッダを変更しました\\n" -#: quilt/header.in:179 +#: quilt/header.in:170 msgid "Appended text to header of patch %s\\n" msgstr "パッチ %s のヘッダに追加しました\\n" @@ -600,6 +600,7 @@ msgid "Usage: quilt import [-f] [-p num] [-n patch] patchfile ...\\n" msgstr "使い方: quilt import [-f] [-p num] [-n パッチ] パッチファイル ...\\n" #: quilt/import.in:25 +#, fuzzy msgid "" "\n" "Import external patches. The patches will be inserted following the\n" @@ -612,6 +613,10 @@ msgid "" "\tPatch filename to use inside quilt. This option can only be\n" "\tused when importing a single patch.\n" "\n" +"-d {o|a|n}\n" +"\tKeep the old (o), all (a), or new (n) description. This option\n" +"\tmust be specified if both patches include a description.\n" +"\n" "-f\tOverwite/update existing patches.\n" msgstr "" "\n" @@ -627,41 +632,49 @@ msgstr "" "\n" "-f\t存在するパッチの上書き、またはアップデート。\n" -#: quilt/import.in:75 +#: quilt/import.in:67 +msgid "Patch headers differ:\\n" +msgstr "" + +#: quilt/import.in:70 +msgid "Please use -d {o|a|n} to specify which patch header(s) to keep.\\n" +msgstr "" + +#: quilt/import.in:123 msgid "Option \\`-n' can only be used when importing a single patch\\n" msgstr "オプション \\`-n'は、パッチを一つだけ取り込むときのみ有効です。\\n" -#: quilt/import.in:94 +#: quilt/import.in:143 msgid "Patch %s is applied\\n" msgstr "パッチ %s は、すでに適用されています\\n" -#: quilt/import.in:103 +#: quilt/import.in:152 #, fuzzy msgid "Patch %s already exists in series.\\n" msgstr "パッチ %s は seriesの中にありません\\n" -#: quilt/import.in:109 +#: quilt/import.in:158 msgid "Patch %s exists. Replace with -f.\\n" msgstr "パッチ %s は、すでに存在します。-fで置き換えることができます。\\n" -#: quilt/import.in:113 +#: quilt/import.in:169 msgid "Replacing patch %s with new version\\n" msgstr "パッチ %s を新しいバージョンに置き換えます\\n" -#: quilt/import.in:117 +#: quilt/import.in:173 #, fuzzy msgid "Importing patch %s\\n" msgstr "パッチ %s をはずします\\n" -#: quilt/import.in:119 +#: quilt/import.in:175 msgid "Importing patch %s (stored as %s)\\n" msgstr "パッチ %s を取り込んでいます (%s として保存されます)\\n" -#: quilt/import.in:128 +#: quilt/import.in:185 msgid "Failed to import patch %s\\n" msgstr "パッチ %s の取り込みに失敗しました\\n" -#: quilt/import.in:136 +#: quilt/import.in:192 msgid "Failed to insert patch %s into file series\\n" msgstr "seriesファイルへのパッチ %s の書き込みに失敗しました\\n" @@ -1210,7 +1223,7 @@ msgstr "" msgid "Patch %s does not exist\\n" msgstr "パッチ %s は seriesの中にありません\\n" -#: quilt/scripts/patchfns.in:817 +#: quilt/scripts/patchfns.in:831 msgid "" "The quilt meta-data in this tree has version %s, but this version of quilt " "can only handle meta-data formats up to and including version %s. Please pop " @@ -1222,7 +1235,7 @@ msgstr "" "ていません。ダウングレードする前に、pushしたバージョンの quiltを使って、\n" "すべてのパッチを pop してください。\\n" -#: quilt/scripts/patchfns.in:902 +#: quilt/scripts/patchfns.in:916 msgid "" "The working tree was created by an older version of quilt. Please run 'quilt " "upgrade'.\\n" diff --git a/po/quilt.pot b/po/quilt.pot index a29a82a..ea748cf 100644 --- a/po/quilt.pot +++ b/po/quilt.pot @@ -397,11 +397,11 @@ msgid "" "\tCreate a backup copy of the old version of a patch as patch~.\n" msgstr "" -#: quilt/header.in:176 +#: quilt/header.in:167 msgid "Replaced header of patch %s\\n" msgstr "" -#: quilt/header.in:179 +#: quilt/header.in:170 msgid "Appended text to header of patch %s\\n" msgstr "" @@ -422,42 +422,54 @@ msgid "" "\tPatch filename to use inside quilt. This option can only be\n" "\tused when importing a single patch.\n" "\n" +"-d {o|a|n}\n" +"\tKeep the old (o), all (a), or new (n) description. This option\n" +"\tmust be specified if both patches include a description.\n" +"\n" "-f\tOverwite/update existing patches.\n" msgstr "" -#: quilt/import.in:75 +#: quilt/import.in:67 +msgid "Patch headers differ:\\n" +msgstr "" + +#: quilt/import.in:70 +msgid "Please use -d {o|a|n} to specify which patch header(s) to keep.\\n" +msgstr "" + +#: quilt/import.in:123 msgid "Option \\`-n' can only be used when importing a single patch\\n" msgstr "" -#: quilt/import.in:94 +#: quilt/import.in:143 msgid "Patch %s is applied\\n" msgstr "" -#: quilt/import.in:103 +#: quilt/import.in:152 msgid "Patch %s already exists in series.\\n" msgstr "" -#: quilt/import.in:109 +#: quilt/import.in:158 msgid "Patch %s exists. Replace with -f.\\n" msgstr "" -#: quilt/import.in:113 +#: quilt/import.in:169 msgid "Replacing patch %s with new version\\n" msgstr "" -#: quilt/import.in:117 +#: quilt/import.in:173 msgid "Importing patch %s\\n" msgstr "" -#: quilt/import.in:119 +#: quilt/import.in:175 msgid "Importing patch %s (stored as %s)\\n" msgstr "" -#: quilt/import.in:128 +#: quilt/import.in:185 msgid "Failed to import patch %s\\n" msgstr "" -#: quilt/import.in:136 +#: quilt/import.in:192 msgid "Failed to insert patch %s into file series\\n" msgstr "" @@ -854,7 +866,7 @@ msgstr "" msgid "Patch %s does not exist\\n" msgstr "" -#: quilt/scripts/patchfns.in:817 +#: quilt/scripts/patchfns.in:831 msgid "" "The quilt meta-data in this tree has version %s, but this version of quilt " "can only handle meta-data formats up to and including version %s. Please pop " @@ -862,7 +874,7 @@ msgid "" "downgrading.\\n" msgstr "" -#: quilt/scripts/patchfns.in:902 +#: quilt/scripts/patchfns.in:916 msgid "" "The working tree was created by an older version of quilt. Please run 'quilt " "upgrade'.\\n" diff --git a/quilt.changes b/quilt.changes index c42ce5d..bd9bfd2 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Sat Jan 21 21:03:30 CET 2006 - agruen@suse.de + +- Split off strip_diffstat from header command. +- import command: compare patch headers to prevent destruction; + add -d option to choose which header(s) to keep. + +------------------------------------------------------------------- Sat Jan 21 19:44:35 CET 2006 - jayvdb@gmail.com - import command: catch several error conditions. Patches in diff --git a/quilt/header.in b/quilt/header.in index 5cb77e7..9014c5e 100644 --- a/quilt/header.in +++ b/quilt/header.in @@ -62,16 +62,7 @@ maybe_strip_diffstat() { if [ -n "$opt_strip_diffstat" ] then - awk ' - /#? .* \| / \ - { eat = eat $0 "\n" - next } - /^#? .* files? changed(, .* insertions?\(\+\))?(, .* deletions?\(-\))?/ \ - { eat = "" - next } - { print eat $0 - eat = "" } - ' + strip_diffstat else cat fi diff --git a/quilt/import.in b/quilt/import.in index fde4c3d..fb7685f 100644 --- a/quilt/import.in +++ b/quilt/import.in @@ -33,6 +33,10 @@ current top patch, and must be pushed after import to apply them. Patch filename to use inside quilt. This option can only be used when importing a single patch. +-d {o|a|n} + Keep the old (o), all (a), or new (n) description. This option + must be specified if both patches include a description. + -f Overwite/update existing patches. " exit 0 @@ -41,7 +45,45 @@ current top patch, and must be pushed after import to apply them. fi } -options=`getopt -o fn:p:h -- "$@"` +merge_patches() +{ + local old="$1" new="$2" old_desc new_desc + + old_desc=$(cat "$old" | patch_header | strip_diffstat) + new_desc=$(cat "$new" | patch_header | strip_diffstat) + + if [ -z "$opt_desc" ] + then + [ -z "$old_desc" ] && opt_desc=n + [ -z "$opt_desc" -a -z "$new_desc" ] && opt_desc=o + + if [ -z "$opt_desc" ] + then + local diff=$(diff -U-1 <(echo "$old_desc") \ + <(echo "$new_desc") \ + | sed -e '1,2d') + if [ -n "$diff" ] + then + printf $"Patch headers differ:\n" >&2 + echo "$diff" >&2 + printf \ +$"Please use -d {o|a|n} to specify which patch header(s) to keep.\n" >&2 + return 1 + fi + fi + fi + + [ $opt_desc = n ] || echo "$old_desc" + [ $opt_desc = a ] && echo '---' + if [ $opt_desc = o ] + then + cat "$new" | patch_body + else + cat "$new" + fi +} + +options=`getopt -o d:fn:p:h -- "$@"` if [ $? -ne 0 ] then @@ -59,6 +101,12 @@ do -p) opt_strip=$2 shift 2 ;; + -d) + case "$2" in + o|n|a) opt_desc=$2 ;; + *) usage ;; + esac + shift 2 ;; -f) opt_force=1 shift ;; @@ -88,6 +136,7 @@ do fi patch_file=$(find_patch_file $patch_file) || exit 1 + merged_patch_file=$patch_file if is_applied $patch then @@ -110,6 +159,13 @@ do "$(print_patch $patch)" >&2 exit 1 fi + if [ "$opt_desc" != n ] + then + merged_patch_file=$(gen_tempfile) + merge_patches "$dest" "$patch_file" \ + > $merged_patch_file \ + || exit 1 + fi printf $"Replacing patch %s with new version\n" \ "$(print_patch $patch)" >&2 elif [ -e "$dest" ] @@ -123,10 +179,10 @@ do mkdir -p "${dest%/*}" fi - if [ "$patch_file" != "$dest" ] && ! cp "$patch_file" "$dest" + if [ "$merged_patch_file" != "$dest" ] && \ + ! cp "$merged_patch_file" "$dest" then - printf $"Failed to import patch %s\n" \ - "$(print_patch $patch)" >&2 + printf $"Failed to import patch %s\n" "$(print_patch $patch)" >&2 exit 1 fi @@ -139,6 +195,7 @@ do fi rm -rf $QUILT_PC/$patch + [ "$merged_patch_file" != "$patch_file" ] && rm -f "$merged_patch_file" done ### Local Variables: diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index ba5d37a..e518721 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -754,6 +754,20 @@ patch_body() ' } +strip_diffstat() +{ + awk ' + /#? .* \| / \ + { eat = eat $0 "\n" + next } + /^#? .* files? changed(, .* insertions?\(\+\))?(, .* deletions?\(-\))?/ \ + { eat = "" + next } + { print eat $0 + eat = "" } + ' +} + in_array() { local a=$1 diff --git a/test/import.test b/test/import.test index 7820b06..3f7ebfc 100644 --- a/test/import.test +++ b/test/import.test @@ -81,17 +81,35 @@ # a simple use of import + $ quilt import t/patch1.diff + > Patch patches/patch1.diff exists. Replace with -f. + + $ quilt import -f t/patch1.diff + > Replacing patch patches/patch1.diff with new version + + # an import requiring a description merge $ sed -e 's/original/new/' patches/patch1.diff > t/patch1.diff $ quilt import t/patch1.diff > Patch patches/patch1.diff exists. Replace with -f. $ quilt import -f t/patch1.diff + > 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 > Replacing patch patches/patch1.diff with new version - $ ls patches/ - > patch1.diff - > patch2.diff - > series + # quilt header does not work in this case because it stops at '---' + $ head -n 3 patches/patch1.diff + > original description + > --- + > new description + + $ quilt import -d n -f t/patch1.diff + > Replacing patch patches/patch1.diff with new version $ quilt header patch1 > new description |