test-ssh-clone-r
100 lines
| 1.8 KiB
| text/plain
|
TextLexer
/ tests / test-ssh-clone-r
Eric Hopper
|
r3449 | #!/bin/sh | ||
# This test tries to exercise the ssh functionality with a dummy script | ||||
Alexis S. L. Carvalho
|
r4299 | cat <<EOF > dummyssh | ||
import sys | ||||
import os | ||||
Eric Hopper
|
r3449 | |||
Alexis S. L. Carvalho
|
r4299 | os.chdir(os.path.dirname(sys.argv[0])) | ||
if sys.argv[1] != "user@dummy": | ||||
sys.exit(-1) | ||||
if not os.path.exists("dummyssh"): | ||||
sys.exit(-1) | ||||
Eric Hopper
|
r3449 | |||
Alexis S. L. Carvalho
|
r4299 | os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" | ||
Eric Hopper
|
r3449 | |||
Alexis S. L. Carvalho
|
r4299 | log = open("dummylog", "ab") | ||
log.write("Got arguments") | ||||
for i, arg in enumerate(sys.argv[1:]): | ||||
log.write(" %d:%s" % (i+1, arg)) | ||||
log.write("\n") | ||||
log.close() | ||||
r = os.system(sys.argv[2]) | ||||
sys.exit(bool(r)) | ||||
Eric Hopper
|
r3449 | EOF | ||
hg init remote | ||||
cd remote | ||||
echo "# creating 'remote'" | ||||
cat >>afile <<EOF | ||||
0 | ||||
EOF | ||||
hg add afile | ||||
hg commit -m "0.0" | ||||
cat >>afile <<EOF | ||||
1 | ||||
EOF | ||||
hg commit -m "0.1" | ||||
cat >>afile <<EOF | ||||
2 | ||||
EOF | ||||
hg commit -m "0.2" | ||||
cat >>afile <<EOF | ||||
3 | ||||
EOF | ||||
hg commit -m "0.3" | ||||
hg update -C 0 | ||||
cat >>afile <<EOF | ||||
1 | ||||
EOF | ||||
hg commit -m "1.1" | ||||
cat >>afile <<EOF | ||||
2 | ||||
EOF | ||||
hg commit -m "1.2" | ||||
cat >fred <<EOF | ||||
a line | ||||
EOF | ||||
cat >>afile <<EOF | ||||
3 | ||||
EOF | ||||
hg add fred | ||||
hg commit -m "1.3" | ||||
hg mv afile adifferentfile | ||||
hg commit -m "1.3m" | ||||
hg update -C 3 | ||||
hg mv afile anotherfile | ||||
hg commit -m "0.3m" | ||||
Benoit Boissinot
|
r3853 | hg debugindex .hg/store/data/afile.i | ||
hg debugindex .hg/store/data/adifferentfile.i | ||||
hg debugindex .hg/store/data/anotherfile.i | ||||
hg debugindex .hg/store/data/fred.i | ||||
hg debugindex .hg/store/00manifest.i | ||||
Eric Hopper
|
r3449 | hg verify | ||
cd .. | ||||
echo "# clone remote via stream" | ||||
for i in 0 1 2 3 4 5 6 7 8; do | ||||
Alexis S. L. Carvalho
|
r4299 | hg clone -e "python ./dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i" 2>&1 | ||
Eric Hopper
|
r3449 | if cd test-"$i"; then | ||
hg verify | ||||
cd .. | ||||
fi | ||||
done | ||||
cd test-8 | ||||
hg pull ../test-7 | ||||
hg verify | ||||
cd .. | ||||
cd test-1 | ||||
Alexis S. L. Carvalho
|
r4299 | hg pull -e "python ../dummyssh" -r 4 ssh://user@dummy/remote 2>&1 | ||
Eric Hopper
|
r3449 | hg verify | ||
Alexis S. L. Carvalho
|
r4299 | hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1 | ||
Eric Hopper
|
r3449 | cd .. | ||
cd test-2 | ||||
Alexis S. L. Carvalho
|
r4299 | hg pull -e "python ../dummyssh" -r 5 ssh://user@dummy/remote 2>&1 | ||
Eric Hopper
|
r3449 | hg verify | ||
Alexis S. L. Carvalho
|
r4299 | hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1 | ||
Eric Hopper
|
r3449 | hg verify | ||
cd .. | ||||