Mercurial > hg-stable
changeset 10217:2bbb4c8eb27e stable
Add test for relink extension
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 08 Jan 2010 22:30:07 +0100 |
parents | a474f950357b |
children | 750b7a4f01f6 |
files | tests/test-relink tests/test-relink.out |
diffstat | 2 files changed, 68 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-relink Fri Jan 08 22:30:07 2010 +0100 @@ -0,0 +1,44 @@ +#!/bin/sh + +echo "[extensions]" >> $HGRCPATH +echo "relink=" >> $HGRCPATH + +cat > arelinked.py <<EOF +import sys, os +path1, path2 = sys.argv[1:3] +if os.stat(path1).st_ino == os.stat(path2).st_ino: + 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 +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 + +echo '% relink' +hg relink --debug | sed 's:relinking.*store:relinking .hg/store:g' +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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-relink.out Fri Jan 08 22:30:07 2010 +0100 @@ -0,0 +1,24 @@ +% 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 +collected 4 candidate storage files +not linkable: 00changelog.i +not linkable: 00manifest.i +not linkable: data/b.i +pruned down to 1 probably relinkable files +relink: data/a.i 1/1 files (1e+02%) +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