test-relink.t
110 lines
| 2.7 KiB
| text/troff
|
Tads3Lexer
/ tests / test-relink.t
Matt Mackall
|
r22046 | #require hardlink | ||
Mads Kiilerich
|
r16971 | |||
Nicolas Dumazet
|
r12115 | $ echo "[extensions]" >> $HGRCPATH | ||
$ echo "relink=" >> $HGRCPATH | ||||
$ fix_path() { | ||||
> tr '\\' / | ||||
> } | ||||
$ cat > arelinked.py <<EOF | ||||
Augie Fackler
|
r33990 | > import os | ||
> import sys | ||||
Matt Harbison
|
r40343 | > from mercurial import ( | ||
> pycompat, | ||||
> util, | ||||
> ) | ||||
Nicolas Dumazet
|
r12115 | > path1, path2 = sys.argv[1:3] | ||
Matt Harbison
|
r40343 | > if util.samefile(pycompat.fsencode(path1), pycompat.fsencode(path2)): | ||
Augie Fackler
|
r33990 | > print('%s == %s' % (path1, path2)) | ||
Nicolas Dumazet
|
r12115 | > else: | ||
Augie Fackler
|
r33990 | > print('%s != %s' % (path1, path2)) | ||
Nicolas Dumazet
|
r12115 | > EOF | ||
create source repository | ||||
$ hg init repo | ||||
$ cd repo | ||||
$ echo a > a | ||||
$ echo b > b | ||||
$ hg ci -Am addfile | ||||
adding a | ||||
adding b | ||||
Thomas Arendsen Hein
|
r16350 | $ cat "$TESTDIR/binfile.bin" >> a | ||
$ cat "$TESTDIR/binfile.bin" >> b | ||||
Nicolas Dumazet
|
r12115 | $ hg ci -Am changefiles | ||
Martin Geisler
|
r13656 | make another commit to create files larger than 1 KB to test | ||
formatting of final byte count | ||||
Thomas Arendsen Hein
|
r16350 | $ cat "$TESTDIR/binfile.bin" >> a | ||
$ cat "$TESTDIR/binfile.bin" >> b | ||||
Martin Geisler
|
r13656 | $ hg ci -m anotherchange | ||
Martin Geisler
|
r13657 | don't sit forever trying to double-lock the source repo | ||
$ hg relink . | ||||
Matt Harbison
|
r35394 | relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store | ||
Martin Geisler
|
r13657 | there is nothing to relink | ||
Martin Geisler
|
r13659 | |||
Nicolas Dumazet
|
r12115 | Test files are read in binary mode | ||
Matt Harbison
|
r39743 | $ "$PYTHON" -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\r\nb\n')" | ||
Nicolas Dumazet
|
r12115 | $ cd .. | ||
clone and pull to break links | ||||
$ hg clone --pull -r0 repo clone | ||||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
added 1 changesets with 2 changes to 2 files | ||||
Denis Laxalde
|
r34662 | new changesets 008c0c271c47 | ||
Nicolas Dumazet
|
r12115 | updating to branch default | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ cd clone | ||||
$ hg pull -q | ||||
$ echo b >> b | ||||
$ hg ci -m changeb | ||||
created new head | ||||
Matt Harbison
|
r39743 | $ "$PYTHON" -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\nb\r\n')" | ||
Nicolas Dumazet
|
r12115 | |||
relink | ||||
Gregory Szorc
|
r37356 | #if no-reposimplestore | ||
Pierre-Yves David
|
r25125 | $ hg relink --debug --config progress.debug=true | fix_path | ||
Mads Kiilerich
|
r12640 | relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store | ||
Nicolas Dumazet
|
r12115 | tip has 2 files, estimated total number of files: 3 | ||
r52074 | collecting: 00changelog.d 1/3 files (33.33%) | |||
collecting: 00changelog.i 2/3 files (66.67%) | ||||
collecting: 00manifest.i 3/3 files (100.00%) | ||||
collecting: a.i 4/3 files (133.33%) | ||||
collecting: b.i 5/3 files (166.67%) | ||||
collecting: dummy.i 6/3 files (200.00%) | ||||
collected 6 candidate storage files | ||||
not linkable: 00changelog.d | ||||
Nicolas Dumazet
|
r12115 | not linkable: 00changelog.i | ||
not linkable: 00manifest.i | ||||
r52074 | pruning: data/a.i 4/6 files (66.67%) | |||
Nicolas Dumazet
|
r12115 | not linkable: data/b.i | ||
r52074 | pruning: data/dummy.i 6/6 files (100.00%) | |||
Nicolas Dumazet
|
r12115 | pruned down to 2 probably relinkable files | ||
timeless
|
r12744 | relinking: data/a.i 1/2 files (50.00%) | ||
Nicolas Dumazet
|
r12115 | not linkable: data/dummy.i | ||
Siddharth Agarwal
|
r23285 | relinked 1 files (1.36 KB reclaimed) | ||
Nicolas Dumazet
|
r12115 | $ cd .. | ||
check hardlinks | ||||
Matt Harbison
|
r39743 | $ "$PYTHON" arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i | ||
Nicolas Dumazet
|
r12115 | repo/.hg/store/data/a.i == clone/.hg/store/data/a.i | ||
Matt Harbison
|
r39743 | $ "$PYTHON" arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i | ||
Nicolas Dumazet
|
r12115 | repo/.hg/store/data/b.i != clone/.hg/store/data/b.i | ||
Gregory Szorc
|
r37356 | #endif | ||