summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2004-06-10 20:12:03 +0000
committerAndreas Gruenbacher <agruen@suse.de>2004-06-10 20:12:03 +0000
commitd5ef4c2259909693c0f4e25cbcf3067911eee5a9 (patch)
treee7dc91692dad414a3a4017cb8bb560de7c9ccc89
parent71d64f6c066574e47dfc0363efc576dd21474f8e (diff)
downloadquilt-d5ef4c2259909693c0f4e25cbcf3067911eee5a9.tar.gz
- Oops, forgot to add files.v0.34
-rw-r--r--quilt/upgrade.in110
-rw-r--r--test/create-delete.diff44
2 files changed, 154 insertions, 0 deletions
diff --git a/quilt/upgrade.in b/quilt/upgrade.in
new file mode 100644
index 0000000..2b9a61b
--- /dev/null
+++ b/quilt/upgrade.in
@@ -0,0 +1,110 @@
+#! @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.
+
+# Don't abort in version check.
+skip_version_check=1
+
+# 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
+
+usage()
+{
+ echo $"Usage: quilt upgrade"
+ if [ x$1 = x-h ]
+ then
+ echo $"
+Upgrade the meta-data in a working tree from an old version of quilt to the
+current version. This command is only needed when the quilt meta-data format
+has changed, and the working tree still contains old-format meta-data. In that
+case, quilt will request to run \`quilt upgrade'."
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+options=`getopt -o h -- "$@"`
+
+if [ $? -ne 0 ]
+then
+ usage
+fi
+
+eval set -- "$options"
+
+while true
+do
+ case "$1" in
+ -h)
+ usage -h ;;
+ --)
+ shift
+ break ;;
+ esac
+done
+
+if [ $# -gt 1 ]
+then
+ usage
+fi
+
+if version_check
+then
+ echo $"The quilt meta-data in $QUILT_PC/ already are have format version $DB_VERSION; nothing to do"
+ exit 0
+fi
+
+echo $"Converting meta-data to version $DB_VERSION"
+
+# Previously we have stripped standard patch extensions (.dif .diff
+# .patch .gz .bz2) of patch names; we have used the mangled names in
+# .pc/applied-patches, .pc/$patch/, but not in the series file.
+
+for patch in $(applied_patches)
+do
+ proper_name="$(grep -E -e '^'"$(quote_re $patch)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)' $SERIES)"
+ proper_name=${proper_name#$QUILT_PATCHES/}
+ proper_name=${proper_name// /}
+ if [ -z "$proper_name" ]
+ then
+ failed=1
+ break
+ fi
+
+ if [ "$patch" != "$proper_name" -a -d $QUILT_PC/$patch ] \
+ && grep -q "^$(quote_bre $patch)\$" \
+ $QUILT_PC/applied-patches
+ then
+ mv $QUILT_PC/$patch $QUILT_PC/$proper_name \
+ || failed=1
+ rename_in_db $patch $proper_name \
+ || failed=1
+ [ -z "$failed" ] || break
+ fi
+done
+
+if [ -n "$failed" ]
+then
+ echo $"Conversion failed"
+ echo $"
+Please remove all patches using \`quilt pop -a' from the quilt version used to create this working tree, or remove the $QUILT_PC directory and apply the patches from scratch." >&2
+ exit 1
+fi
+echo $DB_VERSION > $QUILT_PC/.version
+### Local Variables:
+### mode: shell-script
+### End:
+# vim:filetype=sh
diff --git a/test/create-delete.diff b/test/create-delete.diff
new file mode 100644
index 0000000..6171a06
--- /dev/null
+++ b/test/create-delete.diff
@@ -0,0 +1,44 @@
+Check whether quilt generates patches properly so that GNU patch recognizes
+file creates and deletions.
+
+ $ mkdir d
+ $ cd d
+
+ $ echo delete > delete
+ $ quilt new test.diff
+ > Patch test.diff is now on top
+
+ $ quilt add create
+ > File create added to patch test.diff
+
+ $ echo create > create
+ $ quilt refresh
+ > Refreshed patch test.diff
+
+ $ quilt add delete
+ > File delete added to patch test.diff
+
+ $ rm -f delete
+ $ quilt refresh
+ > Refreshed patch test.diff
+
+ $ quilt pop -q
+ > Removing test.diff
+ > No patches applied
+
+ $ echo create > create
+ $ rm -f delete
+ $ patch -p1 --dry-run < patches/test.diff
+ > The next patch would create the file create,
+ > which already exists! Assume -R? [n]
+ > Apply anyway? [n]
+ > Skipping patch.
+ > 1 out of 1 hunk ignored -- saving rejects to file create.rej
+ > The next patch would delete the file delete,
+ > which does not exist! Assume -R? [n]
+ > Apply anyway? [n]
+ > Skipping patch.
+ > 1 out of 1 hunk ignored
+
+ $ cd ..
+ $ rm -rf d