test-relink
54 lines
| 1.2 KiB
| text/plain
|
TextLexer
/ tests / test-relink
Patrick Mezard
|
r10217 | #!/bin/sh | ||
echo "[extensions]" >> $HGRCPATH | ||||
echo "relink=" >> $HGRCPATH | ||||
Siddharth Agarwal
|
r10218 | fix_path() | ||
{ | ||||
tr '\\' / | ||||
} | ||||
Patrick Mezard
|
r10217 | cat > arelinked.py <<EOF | ||
import sys, os | ||||
Siddharth Agarwal
|
r10218 | from mercurial import util | ||
Patrick Mezard
|
r10217 | path1, path2 = sys.argv[1:3] | ||
Siddharth Agarwal
|
r10218 | if util.samefile(path1, path2): | ||
Patrick Mezard
|
r10217 | 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 | ||||
Siddharth Agarwal
|
r10218 | # Test files are read in binary mode | ||
python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')" | ||||
Patrick Mezard
|
r10217 | 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 | ||||
Siddharth Agarwal
|
r10218 | python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')" | ||
Patrick Mezard
|
r10217 | |||
echo '% relink' | ||||
Siddharth Agarwal
|
r10218 | hg relink --debug | sed 's:relinking.*store:relinking .hg/store:g' \ | ||
| fix_path | ||||
Patrick Mezard
|
r10217 | 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 | ||||