# HG changeset patch # User Patrick Mezard # Date 1262986207 -3600 # Node ID 2bbb4c8eb27e872c3b8744fc00c72aa3d17c836a # Parent a474f950357be8acb8704f46b4443872d0461feb Add test for relink extension diff -r a474f950357b -r 2bbb4c8eb27e tests/test-relink --- /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 < .hg/hgrc +echo 'username= A. Foo ' >> .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 ' >> .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 + diff -r a474f950357b -r 2bbb4c8eb27e tests/test-relink.out --- /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