comparison tests/test-hardlinks.t @ 32294:905a2eff08a6

test-hardlinks: unify two test files into one The "whitelisted" test could be unified using "#if"s.
author Jun Wu <quark@fb.com>
date Mon, 15 May 2017 13:25:59 -0700
parents 24f55686a63d
children b9135f191d8a
comparison
equal deleted inserted replaced
32293:ca727147ff9f 32294:905a2eff08a6
8 > print util.nlinks(f), f 8 > print util.nlinks(f), f
9 > EOF 9 > EOF
10 10
11 $ nlinksdir() 11 $ nlinksdir()
12 > { 12 > {
13 > find $1 -type f | python $TESTTMP/nlinks.py 13 > find "$@" -type f | python $TESTTMP/nlinks.py
14 > } 14 > }
15 15
16 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux): 16 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
17 17
18 $ cat > linkcp.py <<EOF 18 $ cat > linkcp.py <<EOF
166 1 r2/.hg/store/00manifest.i 166 1 r2/.hg/store/00manifest.i
167 1 r2/.hg/store/data/d1/f2.i 167 1 r2/.hg/store/data/d1/f2.i
168 2 r2/.hg/store/data/f1.i 168 2 r2/.hg/store/data/f1.i
169 [12] r2/\.hg/store/fncache (re) 169 [12] r2/\.hg/store/fncache (re)
170 170
171 #if hardlink-whitelisted
172 $ nlinksdir r2/.hg/store/fncache
173 2 r2/.hg/store/fncache
174 #endif
175
171 $ hg -R r2 verify 176 $ hg -R r2 verify
172 checking changesets 177 checking changesets
173 checking manifests 178 checking manifests
174 crosschecking files in changesets and manifests 179 crosschecking files in changesets and manifests
175 checking files 180 checking files
191 1 r2/.hg/store/00manifest.i 196 1 r2/.hg/store/00manifest.i
192 1 r2/.hg/store/data/d1/f2.i 197 1 r2/.hg/store/data/d1/f2.i
193 1 r2/.hg/store/data/f1.i 198 1 r2/.hg/store/data/f1.i
194 [12] r2/\.hg/store/fncache (re) 199 [12] r2/\.hg/store/fncache (re)
195 200
201 #if hardlink-whitelisted
202 $ nlinksdir r2/.hg/store/fncache
203 2 r2/.hg/store/fncache
204 #endif
196 205
197 $ cd r3 206 $ cd r3
198 $ hg tip --template '{rev}:{node|short}\n' 207 $ hg tip --template '{rev}:{node|short}\n'
199 11:a6451b6bc41f 208 11:a6451b6bc41f
200 $ echo bla > f1 209 $ echo bla > f1
244 [24] r4/\.hg/undo\.dirstate (re) 253 [24] r4/\.hg/undo\.dirstate (re)
245 2 r4/d1/data1 254 2 r4/d1/data1
246 2 r4/d1/f2 255 2 r4/d1/f2
247 2 r4/f1 256 2 r4/f1
248 257
258 #if hardlink-whitelisted
259 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
260 4 r4/.hg/undo.backup.dirstate
261 4 r4/.hg/undo.dirstate
262 #endif
263
249 Update back to revision 11 in r4 should break hardlink of file f1: 264 Update back to revision 11 in r4 should break hardlink of file f1:
250 265
251 $ hg -R r4 up 11 266 $ hg -R r4 up 11
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 267 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 268
287 [24] r4/\.hg/undo\.dirstate (re) 302 [24] r4/\.hg/undo\.dirstate (re)
288 2 r4/d1/data1 303 2 r4/d1/data1
289 2 r4/d1/f2 304 2 r4/d1/f2
290 1 r4/f1 305 1 r4/f1
291 306
307 #if hardlink-whitelisted
308 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
309 4 r4/.hg/undo.backup.dirstate
310 4 r4/.hg/undo.dirstate
311 #endif
292 312
293 Test hardlinking outside hg: 313 Test hardlinking outside hg:
294 314
295 $ mkdir x 315 $ mkdir x
296 $ echo foo > x/a 316 $ echo foo > x/a