summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-02-05 11:41:09 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-02-05 11:41:09 +0000
commit49e0ddc32a3da6a1e4770b704a0a73badf94f3bf (patch)
treee4889fd785af5dd70d141b7eff9f8e1ee28cb69a
parentdbf3f21f148ec0e4a559fbee3364108940ae4666 (diff)
downloadquilt-49e0ddc32a3da6a1e4770b704a0a73badf94f3bf.tar.gz
Fix minor bugs and add -r option in quilt diff
-rw-r--r--TODO5
-rw-r--r--quilt.changes10
-rw-r--r--quilt/diff.in35
3 files changed, 38 insertions, 12 deletions
diff --git a/TODO b/TODO
index ba647a4..6030675 100644
--- a/TODO
+++ b/TODO
@@ -105,11 +105,6 @@ apatch:
Needs to check if any of the files in the patch are touched by
later patches.
-quilt diff:
-
- - If a patch has been force applied, quilt diff -z cannot succeed
- (unless the patch has been refreshed later). Check for this!
-
touched_by_patch:
- Implement more of patch's filename heuristic: The following
diff --git a/quilt.changes b/quilt.changes
index 9ac64f0..60c839c 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Wed Feb 5 12:37:34 +0100 2003 - agruen@suse.de
+
+- Quilt diff: If a patch has been force applied, quilt diff -z
+ will also have failures when generating the temporary files.
+ Ignore these failures in this case.
+- Add -r option to quilt diff to generate a a reverse patch.
+- Fix deleting the temporary directory (by using an absolute
+ instead of a relative path).
+
+-------------------------------------------------------------------
Sun Feb 2 15:23:20 +0100 2003 - agruen@suse.de
- Make quilt setup recognize the "# Sourcedir:" directive.
diff --git a/quilt/diff.in b/quilt/diff.in
index 0fda3f3..7f1a084 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -24,7 +24,7 @@ usage()
then
redirect='>&2'
fi
- echo "Usage: quilt diff [-p n] [-c patch|-z] [-P patch] [file ...]" $redirect
+ echo "Usage: quilt diff [-p n] [-c patch|-z] [-r] [-P patch] [file ...]" $redirect
if [ x$1 = x-h ]
then
@@ -48,6 +48,8 @@ by default.
Create a combined diff for all patches between this
patch and the patch specified with -P.
+-r Create a reverse diff.
+
-z Write to standard output the changes that have been
made relative to the topmost or specified patch.
@@ -61,6 +63,14 @@ EOF
do_diff()
{
local file=$1 suffix=$2 old_file=$3 new_file=$4
+
+ if [ -n "$opt_reverse" ]
+ then
+ local f=$new_file
+ new_file=$old_file
+ old_file=$f
+ fi
+
if [ -n "$opt_diff" ]
then
if ! @DIFF@ -q $old_file $new_file >/dev/null
@@ -80,7 +90,7 @@ die ()
exit $status
}
-options=`getopt -o p:P:c:zh --long diff: -- "$@"`
+options=`getopt -o p:P:c:rzh --long diff: -- "$@"`
if [ $? -ne 0 ]
then
@@ -101,6 +111,9 @@ do
-c)
opt_combine=$2
shift 2 ;;
+ -r)
+ opt_reverse=1
+ shift ;;
-z)
opt_relative=1
shift ;;
@@ -213,7 +226,7 @@ if [ -n "$opt_relative" ]
then
patch_file=$(patch_file_name $last_patch)
patch_args=$(patch_args $last_patch)
- workdir=$(@MKTEMP@ -d patch-scripts.XXXXXX)
+ workdir=$(@MKTEMP@ -d $PWD/patch-scripts.XXXXXX)
pwd=$PWD
if ! cd .pc/$last_patch
@@ -221,12 +234,12 @@ then
echo "Cannot change into .pc/$last_patch"
die 1
fi
- if ! cp -l --parents "${files[@]}" $pwd/$workdir/
+ if ! cp -l --parents "${files[@]}" $workdir/
then
echo "Failed to copy files to temporary directory"
die 1
fi
- if ! cd $pwd/$workdir
+ if ! cd $workdir
then
echo "Cannot change to temporary directory"
die 1
@@ -238,8 +251,16 @@ then
| @PATCH@ $patch_args --no-backup-if-mismatch \
-E >/dev/null 2>/dev/null
then
- echo "Failed to patch temporary files"
- die 1
+ # If a patch was force applied (and therefore needs
+ # refreshing), we know that patching the temporary
+ # files won't succeed, either. So, ignore the error
+ # in that particular case.
+
+ if ! [ -e $(pc_file_name $last_patch)~refresh ]
+ then
+ echo "Failed to patch temporary files"
+ die 1
+ fi
fi
fi
if ! cd $pwd