##// END OF EJS Templates
test-hardlink: stop explicitly listing `undo.dirstate`...
marmoute -
r50978:a28cedb2 default
parent child Browse files
Show More
@@ -1,441 +1,441 b''
1 1 #require hardlink reporevlogstore
2 2
3 3 $ cat > nlinks.py <<EOF
4 4 > import sys
5 5 > from mercurial import pycompat, util
6 6 > for f in sorted(sys.stdin.readlines()):
7 7 > f = f[:-1]
8 8 > print(util.nlinks(pycompat.fsencode(f)), f)
9 9 > EOF
10 10
11 11 $ nlinksdir()
12 12 > {
13 13 > find "$@" -type f | "$PYTHON" $TESTTMP/nlinks.py
14 14 > }
15 15
16 16 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
17 17
18 18 $ cat > linkcp.py <<EOF
19 19 > import sys
20 20 > from mercurial import pycompat, util
21 21 > util.copyfiles(pycompat.fsencode(sys.argv[1]),
22 22 > pycompat.fsencode(sys.argv[2]), hardlink=True)
23 23 > EOF
24 24
25 25 $ linkcp()
26 26 > {
27 27 > "$PYTHON" $TESTTMP/linkcp.py $1 $2
28 28 > }
29 29
30 30 Prepare repo r1:
31 31
32 32 $ hg init r1
33 33 $ cd r1
34 34
35 35 $ echo c1 > f1
36 36 $ hg add f1
37 37 $ hg ci -m0
38 38
39 39 $ mkdir d1
40 40 $ cd d1
41 41 $ echo c2 > f2
42 42 $ hg add f2
43 43 $ hg ci -m1
44 44 $ cd ../..
45 45
46 46 $ nlinksdir r1/.hg/store
47 47 1 r1/.hg/store/00changelog.i
48 48 1 r1/.hg/store/00manifest.i
49 49 1 r1/.hg/store/data/d1/f2.i
50 50 1 r1/.hg/store/data/f1.i
51 51 1 r1/.hg/store/fncache (repofncache !)
52 52 1 r1/.hg/store/phaseroots
53 53 1 r1/.hg/store/requires
54 54 1 r1/.hg/store/undo
55 55 1 r1/.hg/store/undo.backup.fncache (repofncache !)
56 56 1 r1/.hg/store/undo.backupfiles
57 57 1 r1/.hg/store/undo.phaseroots
58 58
59 59
60 60 Create hardlinked clone r2:
61 61
62 62 $ hg clone -U --debug r1 r2 --config progress.debug=true
63 63 linking: 1/7 files (14.29%)
64 64 linking: 2/7 files (28.57%)
65 65 linking: 3/7 files (42.86%)
66 66 linking: 4/7 files (57.14%)
67 67 linking: 5/7 files (71.43%)
68 68 linking: 6/7 files (85.71%)
69 69 linking: 7/7 files (100.00%)
70 70 linked 7 files
71 71 updating the branch cache
72 72
73 73 Create non-hardlinked clone r3:
74 74
75 75 $ hg clone --pull r1 r3
76 76 requesting all changes
77 77 adding changesets
78 78 adding manifests
79 79 adding file changes
80 80 added 2 changesets with 2 changes to 2 files
81 81 new changesets 40d85e9847f2:7069c422939c
82 82 updating to branch default
83 83 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 84
85 85
86 86 Repos r1 and r2 should now contain hardlinked files:
87 87
88 88 $ nlinksdir r1/.hg/store
89 89 2 r1/.hg/store/00changelog.i
90 90 2 r1/.hg/store/00manifest.i
91 91 2 r1/.hg/store/data/d1/f2.i
92 92 2 r1/.hg/store/data/f1.i
93 93 1 r1/.hg/store/fncache (repofncache !)
94 94 1 r1/.hg/store/phaseroots
95 95 1 r1/.hg/store/requires
96 96 1 r1/.hg/store/undo
97 97 1 r1/.hg/store/undo.backup.fncache (repofncache !)
98 98 1 r1/.hg/store/undo.backupfiles
99 99 1 r1/.hg/store/undo.phaseroots
100 100
101 101 $ nlinksdir r2/.hg/store
102 102 2 r2/.hg/store/00changelog.i
103 103 2 r2/.hg/store/00manifest.i
104 104 2 r2/.hg/store/data/d1/f2.i
105 105 2 r2/.hg/store/data/f1.i
106 106 1 r2/.hg/store/fncache (repofncache !)
107 107 1 r2/.hg/store/requires
108 108
109 109 Repo r3 should not be hardlinked:
110 110
111 111 $ nlinksdir r3/.hg/store
112 112 1 r3/.hg/store/00changelog.i
113 113 1 r3/.hg/store/00manifest.i
114 114 1 r3/.hg/store/data/d1/f2.i
115 115 1 r3/.hg/store/data/f1.i
116 116 1 r3/.hg/store/fncache (repofncache !)
117 117 1 r3/.hg/store/phaseroots
118 118 1 r3/.hg/store/requires
119 119 1 r3/.hg/store/undo
120 120 1 r3/.hg/store/undo.backupfiles
121 121 1 r3/.hg/store/undo.phaseroots
122 122
123 123
124 124 Create a non-inlined filelog in r3:
125 125
126 126 $ cd r3/d1
127 127 >>> f = open('data1', 'wb')
128 128 >>> for x in range(10000):
129 129 ... f.write(b"%d\n" % x) and None
130 130 >>> f.close()
131 131 $ for j in 0 1 2 3 4 5 6 7 8 9; do
132 132 > cat data1 >> f2
133 133 > hg commit -m$j
134 134 > done
135 135 $ cd ../..
136 136
137 137 $ nlinksdir r3/.hg/store
138 138 1 r3/.hg/store/00changelog.i
139 139 1 r3/.hg/store/00manifest.i
140 140 1 r3/.hg/store/data/d1/f2.d
141 141 1 r3/.hg/store/data/d1/f2.i
142 142 1 r3/.hg/store/data/f1.i
143 143 1 r3/.hg/store/fncache (repofncache !)
144 144 1 r3/.hg/store/phaseroots
145 145 1 r3/.hg/store/requires
146 146 1 r3/.hg/store/undo
147 147 1 r3/.hg/store/undo.backup.fncache (repofncache !)
148 148 1 r3/.hg/store/undo.backup.phaseroots
149 149 1 r3/.hg/store/undo.backupfiles
150 150 1 r3/.hg/store/undo.phaseroots
151 151
152 152 Push to repo r1 should break up most hardlinks in r2:
153 153
154 154 $ hg -R r2 verify -q
155 155
156 156 $ cd r3
157 157 $ hg push
158 158 pushing to $TESTTMP/r1
159 159 searching for changes
160 160 adding changesets
161 161 adding manifests
162 162 adding file changes
163 163 added 10 changesets with 10 changes to 1 files
164 164
165 165 $ cd ..
166 166
167 167 $ nlinksdir r2/.hg/store
168 168 1 r2/.hg/store/00changelog.i
169 169 1 r2/.hg/store/00manifest.i
170 170 1 r2/.hg/store/data/d1/f2.i
171 171 2 r2/.hg/store/data/f1.i
172 172 [12] r2/\.hg/store/fncache (re) (repofncache !)
173 173 1 r2/.hg/store/requires
174 174
175 175 #if hardlink-whitelisted repofncache
176 176 $ nlinksdir r2/.hg/store/fncache
177 177 1 r2/.hg/store/fncache
178 178 #endif
179 179
180 180 $ hg -R r2 verify -q
181 181
182 182 $ cd r1
183 183 $ hg up
184 184 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 185
186 186 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
187 187
188 188 $ echo c1c1 >> f1
189 189 $ hg ci -m00
190 190 $ cd ..
191 191
192 192 $ nlinksdir r2/.hg/store
193 193 1 r2/.hg/store/00changelog.i
194 194 1 r2/.hg/store/00manifest.i
195 195 1 r2/.hg/store/data/d1/f2.i
196 196 1 r2/.hg/store/data/f1.i
197 197 1 r2/.hg/store/fncache (repofncache !)
198 198 1 r2/.hg/store/requires
199 199
200 200 #if hardlink-whitelisted repofncache
201 201 $ nlinksdir r2/.hg/store/fncache
202 202 1 r2/.hg/store/fncache
203 203 #endif
204 204
205 205 Create a file which exec permissions we will change
206 206 $ cd r3
207 207 $ echo "echo hello world" > f3
208 208 $ hg add f3
209 209 $ hg ci -mf3
210 210 $ cd ..
211 211
212 212 $ cd r3
213 213 $ hg tip --template '{rev}:{node|short}\n'
214 214 12:d3b77733a28a
215 215 $ echo bla > f1
216 216 $ chmod +x f3
217 217 $ hg ci -m1
218 218 $ cd ..
219 219
220 220 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
221 221
222 222 $ linkcp r3 r4
223 223
224 224 'checklink' is produced by hardlinking a symlink, which is undefined whether
225 225 the symlink should be followed or not. It does behave differently on Linux and
226 226 BSD. Just remove it so the test pass on both platforms.
227 227
228 228 $ rm -f r4/.hg/wcache/checklink
229 229
230 230 r4 has hardlinks in the working dir (not just inside .hg):
231 231
232 232 $ nlinksdir r4
233 233 2 r4/.hg/00changelog.i
234 234 2 r4/.hg/branch
235 235 2 r4/.hg/cache/branch2-base
236 236 2 r4/.hg/cache/branch2-immutable
237 237 2 r4/.hg/cache/branch2-served
238 238 2 r4/.hg/cache/branch2-served.hidden
239 239 2 r4/.hg/cache/branch2-visible
240 240 2 r4/.hg/cache/branch2-visible-hidden
241 241 2 r4/.hg/cache/rbc-names-v1
242 242 2 r4/.hg/cache/rbc-revs-v1
243 243 2 r4/.hg/cache/tags2
244 244 2 r4/.hg/cache/tags2-served
245 245 2 r4/.hg/dirstate
246 246 2 r4/.hg/fsmonitor.state (fsmonitor !)
247 247 2 r4/.hg/hgrc
248 248 2 r4/.hg/last-message.txt
249 249 2 r4/.hg/requires
250 250 2 r4/.hg/store/00changelog.i
251 251 2 r4/.hg/store/00manifest.i
252 252 2 r4/.hg/store/data/d1/f2.d
253 253 2 r4/.hg/store/data/d1/f2.i
254 254 2 r4/.hg/store/data/f1.i
255 255 2 r4/.hg/store/data/f3.i
256 256 2 r4/.hg/store/fncache (repofncache !)
257 257 2 r4/.hg/store/phaseroots
258 258 2 r4/.hg/store/requires
259 259 2 r4/.hg/store/undo
260 260 2 r4/.hg/store/undo.backup.fncache (repofncache !)
261 261 2 r4/.hg/store/undo.backup.phaseroots
262 262 2 r4/.hg/store/undo.backupfiles
263 263 2 r4/.hg/store/undo.phaseroots
264 264 [24] r4/\.hg/undo\.backup\.dirstate (re)
265 265 2 r4/.hg/undo.bookmarks
266 266 2 r4/.hg/undo.branch
267 267 2 r4/.hg/undo.desc
268 268 [24] r4/\.hg/undo\.dirstate (re)
269 269 2 r4/.hg/wcache/checkisexec (execbit !)
270 270 2 r4/.hg/wcache/checklink-target (symlink !)
271 271 2 r4/.hg/wcache/checknoexec (execbit !)
272 272 2 r4/.hg/wcache/manifestfulltextcache (reporevlogstore !)
273 273 2 r4/d1/data1
274 274 2 r4/d1/f2
275 275 2 r4/f1
276 276 2 r4/f3
277 277
278 278 Update back to revision 12 in r4 should break hardlink of file f1 and f3:
279 279 #if hardlink-whitelisted
280 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
280 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate
281 2 r4/.hg/dirstate
281 282 4 r4/.hg/undo.backup.dirstate
282 4 r4/.hg/undo.dirstate
283 283 #endif
284 284
285 285
286 286 $ hg -R r4 up 12
287 287 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (execbit !)
288 288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-execbit !)
289 289
290 290 $ nlinksdir r4
291 291 2 r4/.hg/00changelog.i
292 292 1 r4/.hg/branch
293 293 2 r4/.hg/cache/branch2-base
294 294 2 r4/.hg/cache/branch2-immutable
295 295 2 r4/.hg/cache/branch2-served
296 296 2 r4/.hg/cache/branch2-served.hidden
297 297 2 r4/.hg/cache/branch2-visible
298 298 2 r4/.hg/cache/branch2-visible-hidden
299 299 2 r4/.hg/cache/rbc-names-v1
300 300 2 r4/.hg/cache/rbc-revs-v1
301 301 2 r4/.hg/cache/tags2
302 302 2 r4/.hg/cache/tags2-served
303 303 1 r4/.hg/dirstate
304 304 1 r4/.hg/fsmonitor.state (fsmonitor !)
305 305 2 r4/.hg/hgrc
306 306 2 r4/.hg/last-message.txt
307 307 2 r4/.hg/requires
308 308 2 r4/.hg/store/00changelog.i
309 309 2 r4/.hg/store/00manifest.i
310 310 2 r4/.hg/store/data/d1/f2.d
311 311 2 r4/.hg/store/data/d1/f2.i
312 312 2 r4/.hg/store/data/f1.i
313 313 2 r4/.hg/store/data/f3.i
314 314 2 r4/.hg/store/fncache
315 315 2 r4/.hg/store/phaseroots
316 316 2 r4/.hg/store/requires
317 317 2 r4/.hg/store/undo
318 318 2 r4/.hg/store/undo.backup.fncache (repofncache !)
319 319 2 r4/.hg/store/undo.backup.phaseroots
320 320 2 r4/.hg/store/undo.backupfiles
321 321 2 r4/.hg/store/undo.phaseroots
322 322 [24] r4/\.hg/undo\.backup\.dirstate (re)
323 323 2 r4/.hg/undo.bookmarks
324 324 2 r4/.hg/undo.branch
325 325 2 r4/.hg/undo.desc
326 326 [24] r4/\.hg/undo\.dirstate (re)
327 327 2 r4/.hg/wcache/checkisexec (execbit !)
328 328 2 r4/.hg/wcache/checklink-target (symlink !)
329 329 2 r4/.hg/wcache/checknoexec (execbit !)
330 330 1 r4/.hg/wcache/manifestfulltextcache (reporevlogstore !)
331 331 2 r4/d1/data1
332 332 2 r4/d1/f2
333 333 1 r4/f1
334 334 1 r4/f3 (execbit !)
335 335 2 r4/f3 (no-execbit !)
336 336
337 337 #if hardlink-whitelisted
338 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
338 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/dirstate
339 1 r4/.hg/dirstate
339 340 4 r4/.hg/undo.backup.dirstate
340 4 r4/.hg/undo.dirstate
341 341 #endif
342 342
343 343 Test hardlinking outside hg:
344 344
345 345 $ mkdir x
346 346 $ echo foo > x/a
347 347
348 348 $ linkcp x y
349 349 $ echo bar >> y/a
350 350
351 351 No diff if hardlink:
352 352
353 353 $ diff x/a y/a
354 354
355 355 Test mq hardlinking:
356 356
357 357 $ echo "[extensions]" >> $HGRCPATH
358 358 $ echo "mq=" >> $HGRCPATH
359 359
360 360 $ hg init a
361 361 $ cd a
362 362
363 363 $ hg qimport -n foo - << EOF
364 364 > # HG changeset patch
365 365 > # Date 1 0
366 366 > diff -r 2588a8b53d66 a
367 367 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
368 368 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
369 369 > @@ -0,0 +1,1 @@
370 370 > +a
371 371 > EOF
372 372 adding foo to series file
373 373
374 374 $ hg qpush
375 375 applying foo
376 376 now at: foo
377 377
378 378 $ cd ..
379 379 $ linkcp a b
380 380 $ cd b
381 381
382 382 $ hg qimport -n bar - << EOF
383 383 > # HG changeset patch
384 384 > # Date 2 0
385 385 > diff -r 2588a8b53d66 a
386 386 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
387 387 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
388 388 > @@ -0,0 +1,1 @@
389 389 > +b
390 390 > EOF
391 391 adding bar to series file
392 392
393 393 $ hg qpush
394 394 applying bar
395 395 now at: bar
396 396
397 397 $ cat .hg/patches/status
398 398 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
399 399 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
400 400
401 401 $ cat .hg/patches/series
402 402 foo
403 403 bar
404 404
405 405 $ cat ../a/.hg/patches/status
406 406 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
407 407
408 408 $ cat ../a/.hg/patches/series
409 409 foo
410 410
411 411 Test tags hardlinking:
412 412
413 413 $ hg qdel -r qbase:qtip
414 414 patch foo finalized without changeset message
415 415 patch bar finalized without changeset message
416 416
417 417 $ hg tag -l lfoo
418 418 $ hg tag foo
419 419
420 420 $ cd ..
421 421 $ linkcp b c
422 422 $ cd c
423 423
424 424 $ hg tag -l -r 0 lbar
425 425 $ hg tag -r 0 bar
426 426
427 427 $ cat .hgtags
428 428 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
429 429 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
430 430
431 431 $ cat .hg/localtags
432 432 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
433 433 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
434 434
435 435 $ cat ../b/.hgtags
436 436 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
437 437
438 438 $ cat ../b/.hg/localtags
439 439 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
440 440
441 441 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now