[PATCH] test-hardlinks: add testcase for repo copied with 'cp -al'
Adrian Buehlmann
adrian at cadifra.com
Mon Nov 15 16:34:52 CST 2010
# 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
+
+r4 has hardlinks in the working dir (not just inside .hg):
+
+ $ nlinksdir r4
+ 2 r4/.hg/00changelog.i
+ 2 r4/.hg/branch
+ 2 r4/.hg/branchheads.cache
+ 2 r4/.hg/dirstate
+ 2 r4/.hg/hgrc
+ 2 r4/.hg/last-message.txt
+ 2 r4/.hg/requires
+ 2 r4/.hg/store/00changelog.i
+ 2 r4/.hg/store/00manifest.i
+ 2 r4/.hg/store/data/d1/f2.d
+ 2 r4/.hg/store/data/d1/f2.i
+ 2 r4/.hg/store/data/f1.i
+ 2 r4/.hg/store/fncache
+ 2 r4/.hg/store/undo
+ 2 r4/.hg/tags.cache
+ 2 r4/.hg/undo.branch
+ 2 r4/.hg/undo.desc
+ 2 r4/.hg/undo.dirstate
+ 2 r4/d1/data1
+ 2 r4/d1/f2
+ 2 r4/f1
+
+Update back to revision 11 in r4 should break hardlink of file f1:
+
+ $ hg -R r4 up 11
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+ $ nlinksdir r4
+ 2 r4/.hg/00changelog.i
+ 1 r4/.hg/branch
+ 2 r4/.hg/branchheads.cache
+ 1 r4/.hg/dirstate
+ 2 r4/.hg/hgrc
+ 2 r4/.hg/last-message.txt
+ 2 r4/.hg/requires
+ 2 r4/.hg/store/00changelog.i
+ 2 r4/.hg/store/00manifest.i
+ 2 r4/.hg/store/data/d1/f2.d
+ 2 r4/.hg/store/data/d1/f2.i
+ 2 r4/.hg/store/data/f1.i
+ 2 r4/.hg/store/fncache
+ 2 r4/.hg/store/undo
+ 2 r4/.hg/tags.cache
+ 2 r4/.hg/undo.branch
+ 2 r4/.hg/undo.desc
+ 2 r4/.hg/undo.dirstate
+ 2 r4/d1/data1
+ 2 r4/d1/f2
+ 1 r4/f1
+
More information about the Mercurial-devel
mailing list