##// END OF EJS Templates
merge main and crew
merge main and crew

File last commit:

r16971:8aeb2f1a default
r20621:5beb49fd merge default
Show More
test-relink.t
100 lines | 2.5 KiB | text/troff | Tads3Lexer
Mads Kiilerich
tests: introduce hghave hardlinks...
r16971 $ "$TESTDIR/hghave" hardlink || exit 80
Nicolas Dumazet
tests: unify test-relink
r12115 $ echo "[extensions]" >> $HGRCPATH
$ echo "relink=" >> $HGRCPATH
$ fix_path() {
> tr '\\' /
> }
$ cat > arelinked.py <<EOF
> import sys, os
> from mercurial import util
> path1, path2 = sys.argv[1:3]
> if util.samefile(path1, path2):
> print '%s == %s' % (path1, path2)
> else:
> print '%s != %s' % (path1, path2)
> 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
tests: make tests work if directory contains special characters...
r16350 $ cat "$TESTDIR/binfile.bin" >> a
$ cat "$TESTDIR/binfile.bin" >> b
Nicolas Dumazet
tests: unify test-relink
r12115 $ hg ci -Am changefiles
Martin Geisler
relink: format reclaimed byte count nicely
r13656 make another commit to create files larger than 1 KB to test
formatting of final byte count
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ cat "$TESTDIR/binfile.bin" >> a
$ cat "$TESTDIR/binfile.bin" >> b
Martin Geisler
relink: format reclaimed byte count nicely
r13656 $ hg ci -m anotherchange
Martin Geisler
relink: avoid trying to lock the same repo twice
r13657 don't sit forever trying to double-lock the source repo
$ hg relink .
Mads Kiilerich
tests: make (glob) on windows accept \ instead of /...
r15447 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
Martin Geisler
relink: avoid trying to lock the same repo twice
r13657 there is nothing to relink
Martin Geisler
merge with stable
r13659
Nicolas Dumazet
tests: unify test-relink
r12115 Test files are read in binary mode
$ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
$ 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
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
$ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
relink
$ hg relink --debug | fix_path
Mads Kiilerich
tests: remove redundant globs...
r12640 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
Nicolas Dumazet
tests: unify test-relink
r12115 tip has 2 files, estimated total number of files: 3
collecting: 00changelog.i 1/3 files (33.33%)
collecting: 00manifest.i 2/3 files (66.67%)
collecting: a.i 3/3 files (100.00%)
collecting: b.i 4/3 files (133.33%)
collecting: dummy.i 5/3 files (166.67%)
collected 5 candidate storage files
not linkable: 00changelog.i
not linkable: 00manifest.i
timeless
progress: dropping superfluous space from units
r12744 pruning: data/a.i 3/5 files (60.00%)
Nicolas Dumazet
tests: unify test-relink
r12115 not linkable: data/b.i
timeless
progress: dropping superfluous space from units
r12744 pruning: data/dummy.i 5/5 files (100.00%)
Nicolas Dumazet
tests: unify test-relink
r12115 pruned down to 2 probably relinkable files
timeless
progress: dropping superfluous space from units
r12744 relinking: data/a.i 1/2 files (50.00%)
Nicolas Dumazet
tests: unify test-relink
r12115 not linkable: data/dummy.i
Martin Geisler
relink: format reclaimed byte count nicely
r13656 relinked 1 files (1.37 KB reclaimed)
Nicolas Dumazet
tests: unify test-relink
r12115 $ cd ..
check hardlinks
$ python arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
$ python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
repo/.hg/store/data/b.i != clone/.hg/store/data/b.i