[PATCH V2] test-hardlinks: add testcase for repo copied with 'cp -al'

Christian Ebert blacktrash at gmx.net
Wed Nov 17 11:01:42 CST 2010


Hi Adrian,

* Adrian Buehlmann on Wednesday, November 17, 2010 at 17:02:58 +0100
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1290009270 -3600
> # Node ID 40082f25be6eaf0a21f2b310eeb4f53fbe815689
> # Parent  8b167ee8242fd7117185150a0015a753019f145e
> 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).
> 
> Note that we can't use 'cp -al' since for example MacOS X doesn't
> support these options on cp. I'm thus using the same trick as in
> test-hardlinks-safety.t for creating hardlinks in the working dir.
> 
> diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t
> --- a/tests/test-hardlinks.t
> +++ b/tests/test-hardlinks.t
> @@ -10,6 +10,19 @@
>>    find $1 -type f | python $TESTTMP/nlinks.py
>> }
> 
> +Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
> +
> +  $ cat > linkcp.py <<EOF
> +  > from mercurial import util
> +  > import sys
> +  > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
> +  > EOF
> +
> +  $ linkcp()
> +  > {
> +  >     python $TESTTMP/linkcp.py $1 $2
> +  > }

That does the trick here on MacOS 10.5.8, test succeeds.

c
-- 
\black\trash movie         _SAME  TIME  SAME  PLACE_
 --->> http://www.blacktrash.org/underdogma/stsp.php
\black\trash audio   _ANOTHER  TIME  ANOTHER  PLACE_
--->> http://www.blacktrash.org/underdogma/atap.html


More information about the Mercurial-devel mailing list