All,
I like this feature, but something's still wrong with the proposed patch: the
QUILT_DIFF_A_B setting conflicts with -pN in series.conf, and as diff and
refresh options. How about the attached alternative implementation instead?
Thanks,
Andreas
Index: quilt.quiltrc
===================================================================
RCS file: /sources/quilt/quilt/quilt.quiltrc,v
retrieving revision 1.8
diff -u -r1.8 quilt.quiltrc
--- quilt.quiltrc 29 Jan 2006 22:19:40 -0000 1.8
+++ quilt.quiltrc 3 Jun 2006 17:32:33 -0000
@@ -12,6 +12,10 @@
QUILT_DIFF_ARGS="--no-timestamps --color=auto"
QUILT_REFRESH_ARGS="--no-timestamps --backup"
+# (Add "-p ab" to QUILT_DIFF_ARGS and QUILT_REFRESH_ARGS to get
+# -p1 style diffs with a/file and b/file filenams in headers
+# instead of dir.orig/file and dir/file.)
+
# The directory in which patches are found (defaults to "patches").
#QUILT_PATCHES=patches
Index: quilt/diff.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/diff.in,v
retrieving revision 1.65
diff -u -r1.65 diff.in
--- quilt/diff.in 1 Feb 2006 04:04:06 -0000 1.65
+++ quilt/diff.in 3 Jun 2006 17:32:34 -0000
@@ -32,6 +32,10 @@
-p n Create a -p n style patch (-p0 or -p1 are supported).
+-p ab Create a -p1 style patch, but use a/file and b/file as the
+ original and new filenames instead of the default
+ dir.orig/file and dir/file names.
+
-u, -U num, -c, -C num
Create a unified diff (-u, -U) with num lines of context. Create
a context diff (-c, -C) with num lines of context. The number of
@@ -220,12 +224,15 @@
then
opt_strip_level=$(patch_strip_level $last_patch)
fi
-if [ "$opt_strip_level" != 0 -a "$opt_strip_level" != 1 ]
-then
+case "$opt_strip_level" in
+0 | 1 | ab)
+ ;;
+*)
printf $"Cannot diff patches with -p%s, please specify -p0 or -p1 instead\n" \
"$opt_strip_level" >&2
die 1
-fi
+ ;;
+esac
trap "die 1" SIGTERM
Index: quilt/patches.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/patches.in,v
retrieving revision 1.23
diff -u -r1.23 patches.in
--- quilt/patches.in 29 Jan 2006 14:44:32 -0000 1.23
+++ quilt/patches.in 3 Jun 2006 17:32:34 -0000
@@ -53,6 +53,7 @@
touched_by_patch()
{
local strip=$1 patch=$2
+ [ $strip = ab ] && strip=1
cat_file $(patch_file_name $patch) \
| awk '
/^\+\+\+[ \t]/ {
Index: quilt/refresh.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/refresh.in,v
retrieving revision 1.57
diff -u -r1.57 refresh.in
--- quilt/refresh.in 29 Jan 2006 14:44:32 -0000 1.57
+++ quilt/refresh.in 3 Jun 2006 17:32:34 -0000
@@ -38,6 +38,10 @@
-p n Create a -p n style patch (-p0 or -p1 supported).
+-p ab Create a -p1 style patch, but use a/file and b/file as the
+ original and new filenames instead of the default
+ dir.orig/file and dir/file names.
+
-u, -U num, -c, -C num
Create a unified diff (-u, -U) with num lines of context. Create
a context diff (-c, -C) with num lines of context. The number of
@@ -144,11 +148,14 @@
then
opt_strip_level=$(patch_strip_level $patch)
fi
-if [ $opt_strip_level -gt 1 ]
-then
+case "$opt_strip_level" in
+0 | 1 | ab)
+ ;;
+*)
printf $"Cannot refresh patches with -p%s, please specify -p0 or -p1 instead\n" "$opt_strip_level\n" >&2
exit 1
-fi
+ ;;
+esac
trap "die 1" SIGTERM
Index: quilt/scripts/patchfns.in
===================================================================
RCS file: /sources/quilt/quilt/quilt/scripts/patchfns.in,v
retrieving revision 1.15
diff -u -r1.15 patchfns.in
--- quilt/scripts/patchfns.in 26 May 2006 10:18:47 -0000 1.15
+++ quilt/scripts/patchfns.in 3 Jun 2006 17:32:34 -0000
@@ -629,6 +629,7 @@
if [ -e "$patch_file" ]
then
local strip=$(patch_strip_level $patch)
+ [ "$strip" = ab ] && strip=1
awk '
($1 == "+++" || $1 == "---" || $1 == "***") && \
$3 != "----" && $3 != "****" \
@@ -670,7 +671,11 @@
local index old_hdr old_date new_hdr new_date line
: ${opt_strip_level:=1}
- if [ $opt_strip_level -eq 0 ]
+ if [ $opt_strip_level = ab ]
+ then
+ old_hdr=a/$file
+ new_hdr=b/$file
+ elif [ $opt_strip_level -eq 0 ]
then
old_hdr=$file.orig
new_hdr=$file
Index: test/formats.test
===================================================================
RCS file: /sources/quilt/quilt/test/formats.test,v
retrieving revision 1.5
diff -u -r1.5 formats.test
--- test/formats.test 23 Sep 2005 18:34:53 -0000 1.5
+++ test/formats.test 3 Jun 2006 17:32:34 -0000
@@ -104,5 +104,18 @@
> ! new
> 4
+ $ quilt diff -p ab
+ > Index: b/test.txt
+ > ===================================================================
+ > --- a/test.txt
+ > +++ b/test.txt
+ > @@ -1,5 +1,5 @@
+ > 1
+ > 2
+ > -old
+ > +new
+ > 4
+ > 5
+
$ cd ..
$ rm -rf d
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev