test-init
82 lines
| 1.8 KiB
| text/plain
|
TextLexer
/ tests / test-init
Thomas Arendsen Hein
|
r2599 | #!/bin/sh | ||
# This test tries to exercise the ssh functionality with a dummy script | ||||
Alexis S. L. Carvalho
|
r4297 | cat <<EOF > dummyssh | ||
import sys | ||||
import os | ||||
Thomas Arendsen Hein
|
r2599 | |||
Alexis S. L. Carvalho
|
r4297 | os.chdir(os.path.dirname(sys.argv[0])) | ||
if sys.argv[1] != "user@dummy": | ||||
sys.exit(-1) | ||||
Thomas Arendsen Hein
|
r2599 | |||
Alexis S. L. Carvalho
|
r4297 | if not os.path.exists("dummyssh"): | ||
sys.exit(-1) | ||||
Thomas Arendsen Hein
|
r2599 | |||
Alexis S. L. Carvalho
|
r4297 | 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)) | ||||
Thomas Arendsen Hein
|
r2599 | EOF | ||
Alexis S. L. Carvalho
|
r4166 | checknewrepo() | ||
{ | ||||
name=$1 | ||||
if [ -d $name/.hg/store ]; then | ||||
echo store created | ||||
fi | ||||
if [ -f $name/.hg/00changelog.i ]; then | ||||
echo 00changelog.i created | ||||
fi | ||||
cat $name/.hg/requires | ||||
} | ||||
Thomas Arendsen Hein
|
r2599 | echo "# creating 'local'" | ||
hg init local | ||||
Alexis S. L. Carvalho
|
r4166 | checknewrepo local | ||
Thomas Arendsen Hein
|
r2599 | echo this > local/foo | ||
hg ci --cwd local -A -m "init" -d "1000000 0" | ||||
Alexis S. L. Carvalho
|
r4166 | echo "# creating repo with old format" | ||
hg --config format.usestore=false init old | ||||
checknewrepo old | ||||
Benoit Boissinot
|
r3037 | echo "#test failure" | ||
hg init local | ||||
Thomas Arendsen Hein
|
r2599 | echo "# init+push to remote2" | ||
Alexis S. L. Carvalho
|
r4297 | hg init -e "python ./dummyssh" ssh://user@dummy/remote2 | ||
Thomas Arendsen Hein
|
r2599 | hg incoming -R remote2 local | ||
Alexis S. L. Carvalho
|
r4297 | hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2 | ||
Thomas Arendsen Hein
|
r2599 | |||
echo "# clone to remote1" | ||||
Alexis S. L. Carvalho
|
r4297 | hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 | ||
Thomas Arendsen Hein
|
r2599 | |||
Benoit Boissinot
|
r3037 | echo "# init to existing repo" | ||
Alexis S. L. Carvalho
|
r4297 | hg init -e "python ./dummyssh" ssh://user@dummy/remote1 | ||
Benoit Boissinot
|
r3037 | |||
echo "# clone to existing repo" | ||||
Alexis S. L. Carvalho
|
r4297 | hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 | ||
Benoit Boissinot
|
r3037 | |||
Thomas Arendsen Hein
|
r2599 | echo "# output of dummyssh" | ||
cat dummylog | ||||
echo "# comparing repositories" | ||||
hg tip -q -R local | ||||
hg tip -q -R remote1 | ||||
hg tip -q -R remote2 | ||||
echo "# check names for repositories (clashes with URL schemes, special chars)" | ||||
for i in bundle file hg http https old-http ssh static-http " " "with space"; do | ||||
echo "# hg init \"$i\"" | ||||
hg init "$i" | ||||
Benoit Boissinot
|
r3713 | test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed" | ||
Thomas Arendsen Hein
|
r2599 | done | ||