summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2005-07-18 14:55:03 +0000
committerAndreas Gruenbacher <agruen@suse.de>2005-07-18 14:55:03 +0000
commit28be8101d1775667e0d7b3bd297b0f7b28570763 (patch)
treed77c7642714d81e92cebf7981fdd53b7f36cb9ef
parent78a7ca38e25c940f034c1cc95a510bfd31a92f47 (diff)
downloadquilt-0.41.tar.gz
- Based on work done by several contributers, add a headerv0.41
command. - Bump version to 0.41.
-rw-r--r--configure.ac4
-rw-r--r--po/de.po8
-rw-r--r--po/fr.po9
-rw-r--r--po/ja.po8
-rw-r--r--po/quilt.pot8
-rw-r--r--quilt.changes7
-rw-r--r--quilt/header.in204
-rw-r--r--quilt/refresh.in6
-rw-r--r--scripts/patchfns.in37
-rw-r--r--test/header.test48
10 files changed, 301 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac
index 069b725..08aa2fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([quilt],[0.40],[quilt-dev@nongnu.org])
+AC_INIT([quilt],[0.41],[quilt-dev@nongnu.org])
AC_CONFIG_AUX_DIR(config)
AC_PREREQ(2.53)
-AC_REVISION ($Revision: 1.36 $)
+AC_REVISION ($Revision: 1.37 $)
PACKAGE_RELEASE=1
AC_SUBST(PACKAGE_RELEASE)
diff --git a/po/de.po b/po/de.po
index 778a0c1..8005ef0 100644
--- a/po/de.po
+++ b/po/de.po
@@ -27,7 +27,7 @@ msgstr "Vorhandene Befehle:"
#, fuzzy
msgid ""
"\n"
-"Common options to all commands:\n"
+"Global options:\n"
"\n"
"--trace\n"
"\tRuns the command in bash trace mode (-x). For internal debugging.\n"
@@ -37,8 +37,6 @@ msgid ""
"\t/etc/quilt.quiltrc if ~/.quiltrc does not exist). See the pdf\n"
"\tdocumentation for details about its possible contents.\n"
"\n"
-"Special options:\n"
-"\n"
"--version\n"
"\tPrint the version number and exit immediately."
msgstr ""
@@ -1179,7 +1177,7 @@ msgstr ""
"zur Erzeugung des Arbeitsverzeichnis verwendet wurden, oder entfernen Sie "
"das Verzeichnis %s, und wenden Sie die Patches neu an.\\n"
-#: ../scripts/patchfns.in:740
+#: ../scripts/patchfns.in:751
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 "
@@ -1192,7 +1190,7 @@ msgstr ""
"quilt alle Patches mit der Version von quilt, die zur Erstellung des "
"Arbeitsverzeichnisses verwendet wurde.\\n"
-#: ../scripts/patchfns.in:817
+#: ../scripts/patchfns.in:828
msgid ""
"The working tree was created by an older version of quilt. Please run 'quilt "
"upgrade'.\\n"
diff --git a/po/fr.po b/po/fr.po
index 1332d42..daa4705 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -26,9 +26,10 @@ msgid "Commands are:"
msgstr "Les commandes sont :"
#: ../bin/quilt.in:31
+#, fuzzy
msgid ""
"\n"
-"Common options to all commands:\n"
+"Global options:\n"
"\n"
"--trace\n"
"\tRuns the command in bash trace mode (-x). For internal debugging.\n"
@@ -38,8 +39,6 @@ msgid ""
"\t/etc/quilt.quiltrc if ~/.quiltrc does not exist). See the pdf\n"
"\tdocumentation for details about its possible contents.\n"
"\n"
-"Special options:\n"
-"\n"
"--version\n"
"\tPrint the version number and exit immediately."
msgstr ""
@@ -1231,7 +1230,7 @@ msgstr ""
"version utilise pour crer cet arbre de travail, ou effacez le rpertoire\n"
"%s et rappliquez compltement vos patchs.\\n"
-#: ../scripts/patchfns.in:740
+#: ../scripts/patchfns.in:751
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 "
@@ -1243,7 +1242,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"
-#: ../scripts/patchfns.in:817
+#: ../scripts/patchfns.in:828
msgid ""
"The working tree was created by an older version of quilt. Please run 'quilt "
"upgrade'.\\n"
diff --git a/po/ja.po b/po/ja.po
index 7eb4192..835e55d 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -28,7 +28,7 @@ msgstr "コマンド一覧:"
#, fuzzy
msgid ""
"\n"
-"Common options to all commands:\n"
+"Global options:\n"
"\n"
"--trace\n"
"\tRuns the command in bash trace mode (-x). For internal debugging.\n"
@@ -38,8 +38,6 @@ msgid ""
"\t/etc/quilt.quiltrc if ~/.quiltrc does not exist). See the pdf\n"
"\tdocumentation for details about its possible contents.\n"
"\n"
-"Special options:\n"
-"\n"
"--version\n"
"\tPrint the version number and exit immediately."
msgstr ""
@@ -1168,7 +1166,7 @@ msgstr ""
"pop -a'を実行し、すべてのパッチをはずしてください。または、%s ディレク\n"
"トリを削除し、最初からパッチをあて直してください。\\n"
-#: ../scripts/patchfns.in:740
+#: ../scripts/patchfns.in:751
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 "
@@ -1180,7 +1178,7 @@ msgstr ""
"ていません。ダウングレードする前に、pushしたバージョンの quiltを使って、\n"
"すべてのパッチを pop してください。\\n"
-#: ../scripts/patchfns.in:817
+#: ../scripts/patchfns.in:828
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 868ee32..005ab4d 100644
--- a/po/quilt.pot
+++ b/po/quilt.pot
@@ -13,7 +13,7 @@ msgstr ""
#: ../bin/quilt.in:31
msgid ""
"\n"
-"Common options to all commands:\n"
+"Global options:\n"
"\n"
"--trace\n"
"\tRuns the command in bash trace mode (-x). For internal debugging.\n"
@@ -23,8 +23,6 @@ msgid ""
"\t/etc/quilt.quiltrc if ~/.quiltrc does not exist). See the pdf\n"
"\tdocumentation for details about its possible contents.\n"
"\n"
-"Special options:\n"
-"\n"
"--version\n"
"\tPrint the version number and exit immediately."
msgstr ""
@@ -844,7 +842,7 @@ msgid ""
"patches from scratch.\\n"
msgstr ""
-#: ../scripts/patchfns.in:740
+#: ../scripts/patchfns.in:751
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 "
@@ -852,7 +850,7 @@ msgid ""
"downgrading.\\n"
msgstr ""
-#: ../scripts/patchfns.in:817
+#: ../scripts/patchfns.in:828
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 35c2bd3..764bdbc 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Mon Jul 18 16:54:16 CEST 2005 - agruen@suse.de
+
+- Based on work done by several contributers, add a header
+ command.
+- Bump version to 0.41.
+
+-------------------------------------------------------------------
Mon Jul 18 12:15:35 CEST 2005 - agruen@suse.de
- quilt/annotate.in: Fix case where the file is created/deleted
diff --git a/quilt/header.in b/quilt/header.in
new file mode 100644
index 0000000..f136d34
--- /dev/null
+++ b/quilt/header.in
@@ -0,0 +1,204 @@
+#! @BASH@
+
+# This script is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# See the COPYING and AUTHORS files for more details.
+
+# Read in library functions
+if [ "$(type -t patch_file_name)" != function ]
+then
+ if ! [ -r @SCRIPTS@/patchfns ]
+ then
+ echo "Cannot read library @SCRIPTS@/patchfns" >&2
+ exit 1
+ fi
+ . @SCRIPTS@/patchfns
+fi
+
+: ${EDITOR:=vi}
+
+usage()
+{
+ printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n"
+
+ if [ x$1 = x-h ]
+ then
+ printf $"
+Print or change the header of the topmost or specified patch.
+
+-a, -r, -e
+ Append to (-a) or replace (-r) the exiting patch header, or
+ edit (-e) the header in \$EDITOR (%s). If none of these options is
+ given, print the patch header.
+
+--strip-diffstat
+ Strip diffstat output from the header.
+
+--strip-trailing-whitespace
+ Strip trailing whitespace at the end of lines of the header.
+
+--backup
+ Create a backup copy of the old version of a patch as patch~.
+" "$EDITOR"
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+maybe_strip_trailing_whitespace()
+{
+ if [ -n "$opt_strip_trailing_whitespace" ]
+ then
+ @SED@ -e 's:[ '$'\t'']*$::'
+ else
+ cat
+ fi
+}
+
+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 = "" }
+ '
+ else
+ cat
+ fi
+}
+
+options=`getopt -o areh --long backup,strip-trailing-whitespace,strip-diffstat -- "$@"`
+
+if [ $? -ne 0 ]
+then
+ usage
+fi
+
+eval set -- "$options"
+
+while true
+do
+ case "$1" in
+ -a)
+ opt_append=1
+ shift ;;
+ -r)
+ opt_replace=1
+ shift ;;
+ -e)
+ opt_edit=1
+ shift ;;
+ --backup)
+ QUILT_BACKUP=1
+ shift ;;
+ --strip-diffstat)
+ opt_strip_diffstat=1
+ shift ;;
+ --strip-trailing-whitespace)
+ opt_strip_trailing_whitespace=1
+ shift ;;
+ -h)
+ usage -h ;;
+ --)
+ shift
+ break ;;
+ esac
+done
+
+case "$opt_append$opt_replace$opt_edit"
+in
+''|1) ;;
+*) usage ;;
+esac
+
+if [ $# -gt 1 ]
+then
+ usage
+fi
+
+[ $# -eq 1 ] && opt_patch=$1
+
+if [ -n "$opt_patch" ]
+then
+ if ! patch=$(find_patch "$opt_patch")
+ then
+ printf $"Patch %s is not in series\n" "$opt_patch" >&2
+ exit 1
+ fi
+else
+ patch=$(top_patch)
+ if [ -z "$patch" ]
+ then
+ printf $"No patches applied\n" >&2
+ exit 1
+ fi
+fi
+
+patch_file=$(patch_file_name $patch)
+
+if [ -z "$opt_replace" -a -z "$opt_append" -a -z "$opt_edit" ]
+then
+ [ -e "$patch_file" ] || exit 0
+
+ cat_file "$patch_file" \
+ | patch_header \
+ | maybe_strip_diffstat \
+ | maybe_strip_trailing_whitespace
+else
+ patch_file_or_null=/dev/null
+ [ -e "$patch_file" ] && patch_file_or_null=$patch_file
+
+ tmp=$(gen_tempfile) || exit 1
+ tmp2=$(gen_tempfile) || exit 1
+ trap "rm -f $tmp $tmp2" EXIT
+
+ ( if [ -z "$opt_replace" ]
+ then
+ cat_file $patch_file_or_null | patch_header
+ fi
+ if [ -n "$opt_append" -o -n "$opt_replace" ]
+ then
+ cat
+ fi
+ ) > $tmp
+
+ if [ -n "$opt_edit" ]
+ then
+ $EDITOR "$tmp" || exit 1
+ fi
+
+ maybe_strip_diffstat < $tmp \
+ | maybe_strip_trailing_whitespace > $tmp2
+
+ cat_file "$patch_file_or_null" | patch_body >> $tmp2 || exit 1
+
+ if ( [ -z "$QUILT_BACKUP" -o ! -e $patch_file ] || \
+ mv $patch_file $patch_file~ ) && \
+ cat_to_new_file $patch_file < $tmp2
+ then
+ if [ -z "$opt_append" ]
+ then
+ printf \
+$"Replaced header of patch %s\n" "$(print_patch $patch)"
+ else
+ printf \
+$"Appended text to header of patch %s\n" "$(print_patch $patch)"
+ fi
+ else
+ exit 1
+ fi
+fi
+### Local Variables:
+### mode: shell-script
+### End:
+# vim:filetype=sh
diff --git a/quilt/refresh.in b/quilt/refresh.in
index c3a7fc9..058dcc0 100644
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -247,7 +247,7 @@ fi
mkdir -p $(dirname $patch_file)
-if ! cat_file $patch_file | patch_description > $tmp_header
+if ! cat_file $patch_file | patch_header > $tmp_header
then
die 1
fi
@@ -268,9 +268,9 @@ then
if (index($0, "#") == 1)
prefix="#"
}
- /.*\|.*/ { eat = eat $0 "\n"
+ /^#? .* \| / { eat = eat $0 "\n"
next }
- /.* files? changed(, .* insertions?\(\+\))?(, .* deletions?\(-\))?/ \
+ /^#? .* files? changed(, .* insertions?\(\+\))?(, .* deletions?\(-\))?/ \
{ print_diffstat()
diffstat = "" ; eat = ""
next }
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index b46b362..a70cfed 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -627,21 +627,32 @@ cat_to_new_file()
> "$filename"
}
-patch_description()
+patch_header()
{
- local patch_file=$1
+ @AWK@ '
+ $1 == "***" || $1 == "---" \
+ { exit }
+ /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision [0-9]+(\.[0-9]+)*$/ \
+ { eat = eat $0 "\n"
+ next }
+ { print eat $0
+ eat = "" }
+ '
+}
- if [ -e "$patch_file" -o -z "$patch_file" ]
- then
- @AWK@ '
- $1 == "***" || $1 == "---" { exit }
- /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision [0-9]+(\.[0-9]+)*$/ \
- { eat = eat $0 "\n"
- next }
- { print eat $0
- eat = "" }
- ' $patch_file
- fi
+patch_body()
+{
+ @AWK@ '
+ /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision [0-9]+(\.[0-9]+)*$/ \
+ { eat = eat $0 "\n"
+ next }
+ $1 == "***" || $1 == "---" \
+ { body=1 }
+ body { print eat $0
+ eat = ""
+ next }
+ { eat = "" }
+ '
}
in_array()
diff --git a/test/header.test b/test/header.test
new file mode 100644
index 0000000..371e017
--- /dev/null
+++ b/test/header.test
@@ -0,0 +1,48 @@
+ $ mkdir d
+ $ cd d
+
+ $ echo foo > foo
+ $ quilt new patch
+ > Patch patches/patch is now on top
+
+ $ quilt add foo
+ > File foo added to patch patches/patch
+
+ $ echo bar > foo
+ $ quilt refresh
+ > Refreshed patch patches/patch
+
+ $ mv patches/patch patches/patch~
+ $ echo Header > patches/patch
+ $ cat patches/patch~ >> patches/patch
+ $ quilt header
+ > Header
+
+ $ quilt header -r
+ < Header2
+ > Replaced header of patch patches/patch
+
+ $ quilt header
+ > Header2
+
+ $ quilt header -a
+ < Appended
+ > Appended text to header of patch patches/patch
+
+ $ quilt header
+ > Header2
+ > Appended
+
+ $ cat patches/patch
+ > Header2
+ > Appended
+ > Index: d/foo
+ > ===================================================================
+ > --- d.orig/foo
+ > +++ d/foo
+ > @@ -1 +1 @@
+ > -foo
+ > +bar
+
+ $ cd ..
+ $ rm -rf d