[PATCH] test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann
adrian at cadifra.com
Tue Nov 16 07:45:57 UTC 2010
On 16.11.2010 03:44, Christian Ebert wrote:
> * Adrian Buehlmann on Monday, November 15, 2010 at 23:34:52 +0100
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1289860194 -3600
>> # Node ID 8b4d67efd67b928218ac4fa73ab43d22ff9e8a6c
>> # Parent 3a42651b0a62a44012d10e3f4e19230eec3964e5
>> test-hardlinks: add testcase for repo copied with 'cp -al'
>>
>> This patch adds a case to test-hardlinks.t which demonstrates that
>> hardlinks in the working directory are broken up (using 'hg update').
>>
>> Motivation for this patch:
>>
>> 'hg help clone' shows copying repositories *and* the working directory
>> using 'cp -al', creating hardlinks in the *working directory* too (not
>> just in the store).
>>
>> diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t
>> --- a/tests/test-hardlinks.t
>> +++ b/tests/test-hardlinks.t
>> @@ -152,3 +152,68 @@ Committing a change to f1 in r1 must bre
>> 1 r2/.hg/store/data/f1.i
>> 1 r2/.hg/store/fncache
>>
>> +
>> + $ cd r3
>> + $ hg tip --template '{rev}:{node|short}\n'
>> + 11:a6451b6bc41f
>> + $ echo bla > f1
>> + $ hg ci -m1
>> + $ cd ..
>> +
>> +Create hardlinked copy r4 of r3 using 'cp -al':
>> +
>> + $ cp -al r3 r4
>
> It works on MacOS X - and possibly on BSD - when I change the
> line above to:
>
> $ cp -al r3 r4 2>/dev/null || (cd r3 && find . -print | cpio -dplm ../r4 2>/dev/null; cd ..)
>
> I have to redirect stderr to /dev/null for cpio because it
> complains that it has not selected (all) the files; perhaps
> someone with cpio experience knows about an option to avoid this.
>
> http://www.macgeekery.com/tips/automation/time_machine_for_tiger
>
> c
Thanks for testing on MacOS X. I used Ubuntu.
I think I should be able to replace the 'cp -al' with something portable
(maybe a few lines of python code).
The whole point of adding this testcase is making sure hardlinks in the
working copy are broken up. Because it is so easy on Linux to create
hardlinks in the working copy (which might even be stored on a Windows
share mounted on Linux using the CIFS driver).
More information about the Mercurial-devel
mailing list