sapling/tests/test-relink.t
Mark Thomas e09288137b ui: deprecate ui.progress
Summary:
Remove ui.progress as a method of updating progress.  All progress bars now go
through new-style progress bars.

This also splits out the rendering of progress bars from the reporting of
progress.  All tests are updated to use new-style debug progress bars, which
simply report the position of the progress bar.  Rendering of progress bars
will be tested separately once the progress bar engine has been rewritten.

Reviewed By: quark-zju

Differential Revision: D7329488

fbshipit-source-id: 14f8ab67365ddd98b74986aa25d9abc7a0546144
2018-04-13 21:51:34 -07:00

106 lines
2.7 KiB
Raku

#require hardlink
$ echo "[extensions]" >> $HGRCPATH
$ echo "relink=" >> $HGRCPATH
$ fix_path() {
> tr '\\' /
> }
$ cat > arelinked.py <<EOF
> from __future__ import absolute_import, print_function
> import os
> import sys
> 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
$ cat "$TESTDIR/binfile.bin" >> a
$ cat "$TESTDIR/binfile.bin" >> b
$ hg ci -Am changefiles
make another commit to create files larger than 1 KB to test
formatting of final byte count
$ cat "$TESTDIR/binfile.bin" >> a
$ cat "$TESTDIR/binfile.bin" >> b
$ hg ci -m anotherchange
don't sit forever trying to double-lock the source repo
$ hg relink .
relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store
there is nothing to relink
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
new changesets 008c0c271c47
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
$ $PYTHON -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
relink
$ hg relink --debug --config progress.debug=true | fix_path
relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
tip has 2 files, estimated total number of files: 3
progress: collecting: 00changelog.i 1/3 files (33.33%)
progress: collecting: 00manifest.i 2/3 files (66.67%)
progress: collecting: a.i 3/3 files (100.00%)
progress: collecting: b.i 4/3 files (133.33%)
progress: collecting: dummy.i 5/3 files (166.67%)
progress: collecting (end)
collected 5 candidate storage files
not linkable: 00changelog.i
not linkable: 00manifest.i
progress: pruning: data/a.i 3/5 files (60.00%)
not linkable: data/b.i
progress: pruning: data/dummy.i 5/5 files (100.00%)
progress: pruning (end)
pruned down to 2 probably relinkable files
progress: relinking: data/a.i 1/2 files (50.00%)
not linkable: data/dummy.i
progress: relinking (end)
relinked 1 files (1.36 KB reclaimed)
$ 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