##// END OF EJS Templates
tests: add test-hardlinks.t...
Adrian Buehlmann -
r12967:70b04340 stable
parent child Browse files
Show More
@@ -0,0 +1,154 b''
1 $ cat > nlinks.py <<EOF
2 > import os, sys
3 > for f in sorted(sys.stdin.readlines()):
4 > f = f[:-1]
5 > print os.lstat(f).st_nlink, f
6 > EOF
7
8 $ nlinksdir()
9 > {
10 > find $1 -type f | python $TESTTMP/nlinks.py
11 > }
12
13 Prepare repo r1:
14
15 $ mkdir r1
16 $ cd r1
17 $ hg init
18
19 $ echo c1 > f1
20 $ hg add f1
21 $ hg ci -m0
22
23 $ mkdir d1
24 $ cd d1
25 $ echo c2 > f2
26 $ hg add f2
27 $ hg ci -m1
28 $ cd ../..
29
30 $ nlinksdir r1/.hg/store
31 1 r1/.hg/store/00changelog.i
32 1 r1/.hg/store/00manifest.i
33 1 r1/.hg/store/data/d1/f2.i
34 1 r1/.hg/store/data/f1.i
35 1 r1/.hg/store/fncache
36 1 r1/.hg/store/undo
37
38
39 Create hardlinked clone r2:
40
41 $ hg clone -U --debug r1 r2
42 linked 7 files
43
44 Create non-hardlinked clone r3:
45
46 $ hg clone --pull r1 r3
47 requesting all changes
48 adding changesets
49 adding manifests
50 adding file changes
51 added 2 changesets with 2 changes to 2 files
52 updating to branch default
53 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
54
55
56 Repos r1 and r2 should now contain hardlinked files:
57
58 $ nlinksdir r1/.hg/store
59 2 r1/.hg/store/00changelog.i
60 2 r1/.hg/store/00manifest.i
61 2 r1/.hg/store/data/d1/f2.i
62 2 r1/.hg/store/data/f1.i
63 2 r1/.hg/store/fncache
64 1 r1/.hg/store/undo
65
66 $ nlinksdir r2/.hg/store
67 2 r2/.hg/store/00changelog.i
68 2 r2/.hg/store/00manifest.i
69 2 r2/.hg/store/data/d1/f2.i
70 2 r2/.hg/store/data/f1.i
71 2 r2/.hg/store/fncache
72
73 Repo r3 should not be hardlinked:
74
75 $ nlinksdir r3/.hg/store
76 1 r3/.hg/store/00changelog.i
77 1 r3/.hg/store/00manifest.i
78 1 r3/.hg/store/data/d1/f2.i
79 1 r3/.hg/store/data/f1.i
80 1 r3/.hg/store/fncache
81 1 r3/.hg/store/undo
82
83
84 Create a non-inlined filelog in r3:
85
86 $ cd r3/d1
87 $ python -c 'for x in range(10000): print x' >> data1
88 $ for j in 0 1 2 3 4 5 6 7 8 9; do
89 > cat data1 >> f2
90 > hg commit -m$j
91 > done
92 $ cd ../..
93
94 $ nlinksdir r3/.hg/store
95 1 r3/.hg/store/00changelog.i
96 1 r3/.hg/store/00manifest.i
97 1 r3/.hg/store/data/d1/f2.d
98 1 r3/.hg/store/data/d1/f2.i
99 1 r3/.hg/store/data/f1.i
100 1 r3/.hg/store/fncache
101 1 r3/.hg/store/undo
102
103 Push to repo r1 should break up most hardlinks in r2:
104
105 $ hg -R r2 verify
106 checking changesets
107 checking manifests
108 crosschecking files in changesets and manifests
109 checking files
110 2 files, 2 changesets, 2 total revisions
111
112 $ cd r3
113 $ hg push
114 pushing to $TESTTMP/r1
115 searching for changes
116 adding changesets
117 adding manifests
118 adding file changes
119 added 10 changesets with 10 changes to 1 files
120
121 $ cd ..
122
123 $ nlinksdir r2/.hg/store
124 1 r2/.hg/store/00changelog.i
125 1 r2/.hg/store/00manifest.i
126 1 r2/.hg/store/data/d1/f2.i
127 2 r2/.hg/store/data/f1.i
128 1 r2/.hg/store/fncache
129
130 $ hg -R r2 verify
131 checking changesets
132 checking manifests
133 crosschecking files in changesets and manifests
134 checking files
135 2 files, 2 changesets, 2 total revisions
136
137
138 $ cd r1
139 $ hg up
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141
142 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
143
144 $ echo c1c1 >> f1
145 $ hg ci -m00
146 $ cd ..
147
148 $ nlinksdir r2/.hg/store
149 1 r2/.hg/store/00changelog.i
150 1 r2/.hg/store/00manifest.i
151 1 r2/.hg/store/data/d1/f2.i
152 1 r2/.hg/store/data/f1.i
153 1 r2/.hg/store/fncache
154
General Comments 0
You need to be logged in to leave comments. Login now