From 1d1b43c9077ae04a464bd448a15426bed1677a58 Mon Sep 17 00:00:00 2001 From: wangdi Date: Mon, 3 Nov 2003 11:58:17 +0000 Subject: update quilt from branch HEAD and fix some bugs --- test/conflicts.test | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++ test/merge.test | 87 ++++++++++++++++++++++++++++++++ test/one.test | 39 ++++++++------- 3 files changed, 247 insertions(+), 18 deletions(-) create mode 100644 test/conflicts.test create mode 100644 test/merge.test (limited to 'test') diff --git a/test/conflicts.test b/test/conflicts.test new file mode 100644 index 0000000..b8c6d11 --- /dev/null +++ b/test/conflicts.test @@ -0,0 +1,139 @@ +This test case creates a patch and then applies that patch to a modified +source file. The source file is modified until the patch doesn't apply +anymore, then the patch is fixed. + + $ mkdir d + $ cd d + + $ cat > one.txt + < 1 + < 2 + < 3 + < 4 + < 5 + < 6 + < 7 + < -- + < a + < b + < c + < d + < e + < f + < g + + $ quilt new a.diff + > Patch a is now on top + + $ quilt add one.txt + > File one.txt added to patch a + + $ mv one.txt one.orig + $ sed -e "s/4/4+/" -e 's/d/d+/' one.orig > one.txt + $ quilt refresh + > Refreshed patch a + + $ quilt pop -q + > Removing a + > No patches applied + + + $ sed -e "s/^\\([17]\\)\$/\\1-/" one.orig > one.txt + $ quilt push -q + > Applying a + > Now at patch a + + $ quilt pop -q + > Removing a + > No patches applied + + $ sed -e "s/^\\([1267]\\)\$/\\1-/" one.orig > one.txt + $ quilt push -q + > Applying a + > Now at patch a + + $ quilt pop -q + > Removing a + > No patches applied + + + $ sed -e "s/^\\([123567]\\)\$/\\1-/" one.orig > one.txt + $ quilt push -q + > Applying a + > 1 out of 2 hunks FAILED -- rejects in file one.txt + > Patch a does not apply (enforce with -f) + + $ quilt push -qf + > Applying a + > 1 out of 2 hunks FAILED -- saving rejects to file one.txt.rej + > Applied a (forced; needs refresh) + + $ mv one.txt one.x + $ sed -e "s/4/4+/" one.x > one.txt + $ rm one.x + $ quilt diff -z | grep -v "^\\(---\\|+++\\)" + > Index: d/one.txt + > =================================================================== + > @@ -1,7 +1,7 @@ + > 1- + > 2- + > 3- + > -4 + > +4+ + > 5- + > 6- + > 7- + + $ quilt diff | grep -v "^\\(---\\|+++\\)" + > Index: d/one.txt + > =================================================================== + > @@ -1,7 +1,7 @@ + > 1- + > 2- + > 3- + > -4 + > +4+ + > 5- + > 6- + > 7- + > @@ -9,7 +9,7 @@ + > a + > b + > c + > -d + > +d+ + > e + > f + > g + + $ quilt refresh + > Refreshed patch a + + $ cat patches/a.diff | grep -v "^\\(---\\|+++\\)" + > Index: d/one.txt + > =================================================================== + > @@ -1,7 +1,7 @@ + > 1- + > 2- + > 3- + > -4 + > +4+ + > 5- + > 6- + > 7- + > @@ -9,7 +9,7 @@ + > a + > b + > c + > -d + > +d+ + > e + > f + > g + + $ quilt pop -q + > Removing a + > No patches applied + + $ cd .. + $ rm -rf d diff --git a/test/merge.test b/test/merge.test new file mode 100644 index 0000000..af85b4a --- /dev/null +++ b/test/merge.test @@ -0,0 +1,87 @@ +Test the patch merging functionality of `quilt diff'. + + $ mkdir d + $ cd d + + $ cat > abc.txt + < a + < b + < c + + $ mkdir patches + $ cat > patches/series + < a.diff + < b.diff + < c.diff + + $ cat > patches/a.diff + < --- merge.orig/abc.txt + < +++ merge/abc.txt + < @@ -1 +1 @@ + < -a + < +a+ + + $ cat > patches/b.diff + < --- merge.orig/abc.txt + < +++ merge/abc.txt + < @@ -2 +2 @@ + < -b + < +b+ + + $ cat > patches/c.diff + < --- merge.orig/abc.txt + < +++ merge/abc.txt + < @@ -3 +3 @@ + < -c + < +c+ + + $ quilt push -qa + > Applying a + > Applying b + > Applying c + > Now at patch c + + $ quilt diff -P b.diff | grep -v "^\\(---\\|+++\\)" + > Index: d/abc.txt + > =================================================================== + > @@ -1,3 +1,3 @@ + > a+ + > -b + > +b+ + > c + > More recent patches modify files in b. + + $ quilt diff -c a.diff -P b.diff | grep -v "^\\(---\\|+++\\)" + > Index: d/abc.txt + > =================================================================== + > @@ -1,3 +1,3 @@ + > -a + > -b + > +a+ + > +b+ + > c + > More recent patches modify files in b. + + $ quilt diff -c b.diff | grep -v "^\\(---\\|+++\\)" + > Index: d/abc.txt + > =================================================================== + > @@ -1,3 +1,3 @@ + > a+ + > -b + > -c + > +b+ + > +c+ + + $ quilt diff -c - | grep -v "^\\(---\\|+++\\)" + > Index: d/abc.txt + > =================================================================== + > @@ -1,3 +1,3 @@ + > -a + > -b + > -c + > +a+ + > +b+ + > +c+ + + $ cd .. + $ rm -rf d diff --git a/test/one.test b/test/one.test index 40329a9..d1298c5 100644 --- a/test/one.test +++ b/test/one.test @@ -5,6 +5,8 @@ of the installed quilt with `make check'. (To run, type `./run one.test' in this directory.) + $ mkdir d + $ cd d $ mkdir dir $ echo "This is file one." > dir/file1 $ quilt new patch1.diff @@ -27,18 +29,18 @@ of the installed quilt with `make check'. $ echo "This is file two." > file2 $ quilt diff | sed -e "s/\\t.*//" - > Index: test/file2 + > Index: d/file2 > =================================================================== - > --- test.orig/file2 - > +++ test/file2 + > --- d.orig/file2 + > +++ d/file2 > @@ -0,0 +1 @@ > +This is file two. $ quilt diff -z | sed -e "s/\\t.*//" - > Index: test/file2 + > Index: d/file2 > =================================================================== - > --- test.orig/file2 - > +++ test/file2 + > --- d.orig/file2 + > +++ d/file2 > @@ -0,0 +1 @@ > +This is file two. @@ -48,10 +50,10 @@ of the installed quilt with `make check'. $ quilt diff -z $ echo "Another line has been added." >> dir/file1 $ quilt diff -z | sed -e "s/\\t.*//" - > Index: test/dir/file1 + > Index: d/dir/file1 > =================================================================== - > --- test.orig/dir/file1 - > +++ test/dir/file1 + > --- d.orig/dir/file1 + > +++ d/dir/file1 > @@ -1 +1,2 @@ > This is file one. > +Another line has been added. @@ -74,7 +76,7 @@ of the installed quilt with `make check'. $ quilt pop -R > Removing patch2 - > patching file dir/file3 + > Removing dir/file3 > > Now at patch patch1 @@ -99,10 +101,10 @@ of the installed quilt with `make check'. $ rm file4 $ quilt diff | sed -e "s/\\t.*//" - > Index: test/file4 + > Index: d/file4 > =================================================================== - > --- test.orig/file4 - > +++ test/file4 + > --- d.orig/file4 + > +++ d/file4 > @@ -1 +0,0 @@ > -This is file 4. @@ -118,10 +120,10 @@ of the installed quilt with `make check'. $ echo "Another line added." >> file2 $ quilt diff -z -P patch1 | sed -e "s/\\t.*//" - > Index: test/file2 + > Index: d/file2 > =================================================================== - > --- test.orig/file2 - > +++ test/file2 + > --- d.orig/file2 + > +++ d/file2 > @@ -1 +1,2 @@ > This is file two. > +Another line added. @@ -136,7 +138,7 @@ of the installed quilt with `make check'. $ echo "Another line here, too." >> dir/file3 $ quilt pop -R > Removing subdir/patch3 - > patching file file4 + > Restoring file4 > > Now at patch patch2 @@ -148,4 +150,5 @@ of the installed quilt with `make check'. > Removing patch1 > No patches applied - $ rm -r dir patches + $ cd .. + $ rm -rf d -- cgit