author | Patrick Mezard <pmezard@gmail.com> |
Fri, 11 Jul 2008 14:40:44 +0200 | |
changeset 6806 | 2134d6c09432 |
parent 4297 | 27590c19ad30 |
child 7249 | 671b3e1eac2e |
permissions | -rwxr-xr-x |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 |
#!/bin/sh |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 |
|
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
3 |
# This test tries to exercise the ssh functionality with a dummy script |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 |
|
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
5 |
cat <<EOF > dummyssh |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
6 |
import sys |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
7 |
import os |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 |
|
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
9 |
os.chdir(os.path.dirname(sys.argv[0])) |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
10 |
if sys.argv[1] != "user@dummy": |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
11 |
sys.exit(-1) |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 |
|
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
13 |
if not os.path.exists("dummyssh"): |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
14 |
sys.exit(-1) |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
15 |
|
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
16 |
log = open("dummylog", "ab") |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
17 |
log.write("Got arguments") |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
18 |
for i, arg in enumerate(sys.argv[1:]): |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
19 |
log.write(" %d:%s" % (i+1, arg)) |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
20 |
log.write("\n") |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
21 |
log.close() |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
22 |
r = os.system(sys.argv[2]) |
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
23 |
sys.exit(bool(r)) |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
24 |
EOF |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
25 |
|
4166
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
26 |
checknewrepo() |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
27 |
{ |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
28 |
name=$1 |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
29 |
|
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
30 |
if [ -d $name/.hg/store ]; then |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
31 |
echo store created |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
32 |
fi |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
33 |
|
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
34 |
if [ -f $name/.hg/00changelog.i ]; then |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
35 |
echo 00changelog.i created |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
36 |
fi |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
37 |
|
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
38 |
cat $name/.hg/requires |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
39 |
} |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
40 |
|
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
41 |
echo "# creating 'local'" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
42 |
hg init local |
4166
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
43 |
checknewrepo local |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
44 |
echo this > local/foo |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
45 |
hg ci --cwd local -A -m "init" -d "1000000 0" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
46 |
|
4166
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
47 |
echo "# creating repo with old format" |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
48 |
hg --config format.usestore=false init old |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
49 |
checknewrepo old |
c0271aba6abe
small fixes for the parent patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3713
diff
changeset
|
50 |
|
3037
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
51 |
echo "#test failure" |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
52 |
hg init local |
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
53 |
|
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
54 |
echo "# init+push to remote2" |
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
55 |
hg init -e "python ./dummyssh" ssh://user@dummy/remote2 |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
56 |
hg incoming -R remote2 local |
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
57 |
hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2 |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
58 |
|
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
59 |
echo "# clone to remote1" |
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
60 |
hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
61 |
|
3037
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
62 |
echo "# init to existing repo" |
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
63 |
hg init -e "python ./dummyssh" ssh://user@dummy/remote1 |
3037
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
64 |
|
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
65 |
echo "# clone to existing repo" |
4297
27590c19ad30
test-init: avoid a shell script
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4166
diff
changeset
|
66 |
hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 |
3037
3acb76f0124d
clone: simplifying dest repo creation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2599
diff
changeset
|
67 |
|
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
68 |
echo "# output of dummyssh" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
69 |
cat dummylog |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
70 |
|
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
71 |
echo "# comparing repositories" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
72 |
hg tip -q -R local |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
73 |
hg tip -q -R remote1 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
74 |
hg tip -q -R remote2 |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
75 |
|
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
76 |
echo "# check names for repositories (clashes with URL schemes, special chars)" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
77 |
for i in bundle file hg http https old-http ssh static-http " " "with space"; do |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
78 |
echo "# hg init \"$i\"" |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
79 |
hg init "$i" |
3713
8ae88ed2a3b6
don't create the .hg/data at init time
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3037
diff
changeset
|
80 |
test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed" |
2599
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
81 |
done |
e4b5e48052c6
Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
82 |