[PATCH] tests: add test for symlink regression fixed by ca5cc2976574
Mads Kiilerich
mads at kiilerich.com
Wed Jul 4 18:04:56 CDT 2012
Markus Zapke-Gründemann wrote, On 07/04/2012 08:19 PM:
> Markus Zapke-Gründemann schrieb:
>> # HG changeset patch
>> # User Markus Zapke-Gründemann <markus at keimlink.de>
>> # Date 1341189237 -7200
>> # Branch stable
>> # Node ID d5c33f148540cf8e06211ce22fe2ceb78e507548
>> # Parent 2440822446ce248175dd597f0ec8df24d8d10217
>> tests: add test for symlink regression fixed by ca5cc2976574
>>
>> This is a test for a regression introduced by fcf66193b186 and fixed by
>> ca5cc2976574 for 2.1.2. The fix had a regression test only for merging.
>>
>> diff --git a/tests/test-symlinks.t b/tests/test-symlinks.t
>> --- a/tests/test-symlinks.t
>> +++ b/tests/test-symlinks.t
>> @@ -253,3 +253,25 @@ Issue995: hg copy -A incorrectly handles
>> $ mv dirlink newdir/dirlink
>> $ hg mv -A dirlink newdir/dirlink
>>
>> +
>> +move file and create symlink to it at the original location, then update
>> +regression was introduced by fcf66193b186 and fixed by ca5cc2976574 for 2.1.2
>> +
>> + $ mkdir d1 d2
>> + $ echo c1 > d1/f1
>> + $ hg commit -Am "add real file f1"
>> + adding d1/f1
>> + $ mv d1/f1 d2
>> + $ cd d1
>> + $ ln -s ../d2/f1
>> + $ cd ..
>> + $ hg commit -Am "move f1 and create symlink to original"
>> + adding d2/f1
>> + $ "$TESTDIR/readlink.py" d1/f1
>> + d1/f1 -> ../d2/f1
>> + $ hg up 3
>> + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
>> + $ hg up
>> + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> + $ "$TESTDIR/readlink.py" d1/f1
>> + d1/f1 -> ../d2/f1
> Any thoughts on the patch? ca5cc2976574 added also a test but I think it's
> testing merging. Therefore I submitted this patch to test the scenario
> explicitly where a user encountered the error after upgrading from 1.8.1 to 2.1.
The first thought is that an update really _is_ a merge. That is most
obvious in daily use when you have uncommitted changes and they are
'merged' with the revision you are updating to. A test for the merge
case is thus sufficient and adding more tests will just make the test
suite slightly slower without improving the test coverage.
ca5cc2976574 did however already introduce a few lines of test for
updating from symlink to file that (unintentionally, I presume) wasn't
run. That is now fixed in crew with
http://hg.intevation.org/mercurial/crew/rev/722fd97f6645 .
Adding a small additional change to the test do however give a result
that indicates that there still is an issue in this area:
--- a/tests/test-merge-types.t
+++ b/tests/test-merge-types.t
@@ -80,6 +80,28 @@
Update to link with local change should cause a merge prompt (issue3200):
+ $ ln -sf someotherlink a
+ $ HGMERGE= hg up -y --debug 0
+ resolving manifests
+ overwrite: False, partial: False
+ ancestor: 521a1e40188f, local: 521a1e40188f+, remote: c334dc3be0da
+ a: versions differ -> m
+ preserving a for resolve of a
+ updating: a 1/1 files (100.00%)
+ couldn't find merge tool hgmerge
+ picked tool 'internal:prompt' for a (binary False symlink True)
+ no tool found to merge a
+ keep (l)ocal or take (o)ther? l
+ 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+ $ hg diff --git
+ diff --git a/a b/a
+ --- a/a
+ +++ b/a
+ @@ -1,1 +1,1 @@
+ -a
+ +someotherlink
+ \ No newline at end of file
+
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo data > a
Taking 'local' should not give a file but a symlink.
/Mads
More information about the Mercurial-devel
mailing list