summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quilt.changes5
-rw-r--r--quilt/refresh.in15
-rw-r--r--quilt/scripts/patchfns.in2
-rw-r--r--test/dir-a-b.test79
4 files changed, 95 insertions, 6 deletions
diff --git a/quilt.changes b/quilt.changes
index c3c8a64..72fbe01 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Wed Jun 28 01:29:39 CEST 2006 - agruen@suse.de
+
+- A few more `-p ab' fixes.
+
+-------------------------------------------------------------------
Tue Jun 27 22:22:15 CEST 2006 - agruen@suse.de
- quilt/push.in: Fix a bug introduced with the -p ab support.
diff --git a/quilt/refresh.in b/quilt/refresh.in
index f1fcd03..70af70d 100644
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -149,7 +149,11 @@ then
opt_strip_level=$(patch_strip_level $patch)
fi
case "$opt_strip_level" in
-0 | 1 | ab)
+0 | 1)
+ num_strip_level=$opt_strip_level
+ ;;
+ab)
+ num_strip_level=1
;;
*)
printf $"Cannot refresh patches with -p%s, please specify -p0 or -p1 instead\n" "$opt_strip_level\n" >&2
@@ -206,11 +210,11 @@ fi
# Check for trailing whitespace
if [ -z "$opt_strip_whitespace" ]
then
- $QUILT_DIR/scripts/remove-trailing-ws -n -p$opt_strip_level \
+ $QUILT_DIR/scripts/remove-trailing-ws -n -p$num_strip_level \
< $tmp_patch
else
tmp_patch2=$(gen_tempfile)
- if $QUILT_DIR/scripts/remove-trailing-ws -p$opt_strip_level \
+ if $QUILT_DIR/scripts/remove-trailing-ws -p$num_strip_level \
< $tmp_patch > $tmp_patch2
then
rm -f $tmp_patch
@@ -239,7 +243,8 @@ tmp_result=$(gen_tempfile) || die 1
if [ -n "$opt_diffstat" ]
then
- diffstat="$(diffstat $QUILT_DIFFSTAT_OPTS -p$opt_strip_level $tmp_patch)" || die 1
+ diffstat="$(diffstat $QUILT_DIFFSTAT_OPTS \
+ -p$num_strip_level $tmp_patch)" || die 1
awk '
function print_diffstat(arr, i) {
split(diffstat, arr, "\n")
@@ -288,7 +293,7 @@ else
fi
rm -f $QUILT_PC/$patch~refresh
-if ! change_db_strip_level -p$opt_strip_level $patch
+if ! change_db_strip_level -p$num_strip_level $patch
then
die 1
fi
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 05a6072..5494273 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -713,7 +713,7 @@ diff_file()
fi
if ! [ -s "$new_file" ]
then
- [ $opt_strip_level -eq 0 ] \
+ [ $opt_strip_level = 0 ] \
&& old_hdr=$new_hdr
new_file=/dev/null
new_hdr=/dev/null
diff --git a/test/dir-a-b.test b/test/dir-a-b.test
index 01f0287..cfed806 100644
--- a/test/dir-a-b.test
+++ b/test/dir-a-b.test
@@ -3,6 +3,7 @@
$ cd d
$ echo a > test.txt
+ $ echo d > test3.txt
$ cat > patches/ab.diff
< --- a/test.txt
@@ -10,8 +11,18 @@
< @@ -1 +1 @@
< -a
< +b
+ < --- /dev/null
+ < +++ b/test2.txt
+ < @@ -0,0 +1 @@
+ < +c
+ < --- a/test3.txt
+ < +++ /dev/null
+ < @@ -1 +0,0 @@
+ < -d
$ echo "ab.diff -pab" > patches/series
+ $ quilt series
+ > patches/ab.diff
$ quilt push -q
> Applying patch patches/ab.diff
@@ -23,6 +34,14 @@
> @@ -1 +1 @@
> -a
> +b
+ > --- /dev/null
+ > +++ b/test2.txt
+ > @@ -0,0 +1 @@
+ > +c
+ > --- a/test3.txt
+ > +++ /dev/null
+ > @@ -1 +0,0 @@
+ > -d
$ rm patches/ab.diff
$ quilt refresh --no-index
@@ -34,6 +53,66 @@
> @@ -1 +1 @@
> -a
> +b
+ > --- /dev/null
+ > +++ b/test2.txt
+ > @@ -0,0 +1 @@
+ > +c
+ > --- a/test3.txt
+ > +++ /dev/null
+ > @@ -1 +0,0 @@
+ > -d
+
+ $ quilt pop -qR
+ > Removing patch patches/ab.diff
+ > No patches applied
+
+ $ echo "ab.diff" > patches/series
+
+ $ quilt push -q
+ > Applying patch patches/ab.diff
+ > Now at patch patches/ab.diff
+
+ $ quilt diff -p ab --no-index
+ > --- a/test.txt
+ > +++ b/test.txt
+ > @@ -1 +1 @@
+ > -a
+ > +b
+ > --- /dev/null
+ > +++ b/test2.txt
+ > @@ -0,0 +1 @@
+ > +c
+ > --- a/test3.txt
+ > +++ /dev/null
+ > @@ -1 +0,0 @@
+ > -d
+
+ $ rm patches/ab.diff
+ $ quilt refresh -p ab --no-index
+ > Refreshed patch patches/ab.diff
+
+ $ cat patches/ab.diff
+ > --- a/test.txt
+ > +++ b/test.txt
+ > @@ -1 +1 @@
+ > -a
+ > +b
+ > --- /dev/null
+ > +++ b/test2.txt
+ > @@ -0,0 +1 @@
+ > +c
+ > --- a/test3.txt
+ > +++ /dev/null
+ > @@ -1 +0,0 @@
+ > -d
+
+ $ quilt refresh -p ab --diffstat
+ > Refreshed patch patches/ab.diff
+
+ $ sed -n -e 's/ *//' -e 's/ *|.*//p' patches/ab.diff
+ > test.txt
+ > test2.txt
+ > test3.txt
$ quilt pop -qR
> Removing patch patches/ab.diff