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

Christian Ebert blacktrash at gmx.net
Mon Nov 15 20:44:37 CST 2010


* 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
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions


More information about the Mercurial-devel mailing list