Mercurial > hg
changeset 12115:a0dcbcbd1590
tests: unify test-relink
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 14:01:57 +0900 |
parents | 0a6b2e21bc86 |
children | f51858009328 |
files | tests/test-bisect.t tests/test-churn.t tests/test-inherit-mode.t tests/test-relink tests/test-relink.out tests/test-relink.t tests/test-remove-new.t tests/test-remove.t tests/test-rename-dir-merge.t tests/test-rename.t tests/test-revert-flags.t tests/test-revert-unknown.t tests/test-revert.t tests/test-revset.t tests/test-strict.t |
diffstat | 3 files changed, 89 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-relink Mon Aug 30 13:55:57 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -#!/bin/sh - -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 - -echo '% create source repository' -hg init repo -cd repo -echo '[ui]' > .hg/hgrc -echo 'username= A. Foo <a.foo@bar.com>' >> .hg/hgrc -echo a > a -echo b > b -hg ci -Am addfile -echo a >> a -echo a >> b -hg ci -Am changefiles -# Test files are read in binary mode -python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')" -cd .. - -echo '% clone and pull to break links' -hg clone --pull -r0 repo clone -cd clone -echo '[ui]' >> .hg/hgrc -echo 'username= A. Baz <a.baz@bar.com>' >> .hg/hgrc -hg pull -q -echo b >> b -hg ci -m changeb -python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')" - -echo '% relink' -hg relink --debug | sed 's:relinking.*store:relinking .hg/store:g' \ - | fix_path -cd .. - -echo '% check hardlinks' -python arelinked.py 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 -
--- a/tests/test-relink.out Mon Aug 30 13:55:57 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -% create source repository -adding a -adding b -% clone and pull to break links -requesting all changes -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 -created new head -% relink -relinking .hg/store -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 -pruning: data/a.i 3/5 files (60.00%) -not linkable: data/b.i -pruning: data/dummy.i 5/5 files (100.00%) -pruned down to 2 probably relinkable files -relinking: data/a.i 1/2 files (50.00%) -not linkable: data/dummy.i -relinked 1 files (136 bytes reclaimed) -% check hardlinks -repo/.hg/store/data/a.i == clone/.hg/store/data/a.i -repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-relink.t Mon Aug 30 14:01:57 2010 +0900 @@ -0,0 +1,89 @@ + $ 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 '[ui]' > .hg/hgrc + $ echo 'username= A. Foo <a.foo@bar.com>' >> .hg/hgrc + $ echo a > a + $ echo b > b + $ hg ci -Am addfile + adding a + adding b + $ echo a >> a + $ echo a >> b + $ hg ci -Am changefiles + +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 + requesting all changes + 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 + $ echo '[ui]' >> .hg/hgrc + $ echo 'username= A. Baz <a.baz@bar.com>' >> .hg/hgrc + $ 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 + relinking .*/.hg/store + 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 + pruning: data/a.i 3/5 files (60.00%) + not linkable: data/b.i + pruning: data/dummy.i 5/5 files (100.00%) + pruned down to 2 probably relinkable files + relinking: data/a.i 1/2 files (50.00%) + not linkable: data/dummy.i + relinked 1 files (136 bytes 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 +