##// END OF EJS Templates
tests: unify test-init
Nicolas Dumazet -
r11786:38e3f973 default
parent child Browse files
Show More
@@ -1,89 +1,156 b''
1 #!/bin/sh
2
3 1 # This test tries to exercise the ssh functionality with a dummy script
4 2
5 cat <<EOF > dummyssh
6 import sys
7 import os
8
9 os.chdir(os.path.dirname(sys.argv[0]))
10 if sys.argv[1] != "user@dummy":
11 sys.exit(-1)
3 $ cat <<EOF > dummyssh
4 > import sys
5 > import os
6 >
7 > os.chdir(os.path.dirname(sys.argv[0]))
8 > if sys.argv[1] != "user@dummy":
9 > sys.exit(-1)
10 >
11 > if not os.path.exists("dummyssh"):
12 > sys.exit(-1)
13 >
14 > log = open("dummylog", "ab")
15 > log.write("Got arguments")
16 > for i, arg in enumerate(sys.argv[1:]):
17 > log.write(" %d:%s" % (i+1, arg))
18 > log.write("\n")
19 > log.close()
20 > r = os.system(sys.argv[2])
21 > sys.exit(bool(r))
22 > EOF
12 23
13 if not os.path.exists("dummyssh"):
14 sys.exit(-1)
15
16 log = open("dummylog", "ab")
17 log.write("Got arguments")
18 for i, arg in enumerate(sys.argv[1:]):
19 log.write(" %d:%s" % (i+1, arg))
20 log.write("\n")
21 log.close()
22 r = os.system(sys.argv[2])
23 sys.exit(bool(r))
24 EOF
24 $ checknewrepo()
25 > {
26 > name=$1
27 > if [ -d $name/.hg/store ]; then
28 > echo store created
29 > fi
30 > if [ -f $name/.hg/00changelog.i ]; then
31 > echo 00changelog.i created
32 > fi
33 > cat $name/.hg/requires
34 > }
25 35
26 checknewrepo()
27 {
28 name=$1
36 creating 'local'
29 37
30 if [ -d $name/.hg/store ]; then
31 echo store created
32 fi
38 $ hg init local
39 $ checknewrepo local
40 store created
41 00changelog.i created
42 revlogv1
43 store
44 fncache
45 $ echo this > local/foo
46 $ hg ci --cwd local -A -m "init" -d "1000000 0"
47 adding foo
48
49 creating repo with format.usestore=false
33 50
34 if [ -f $name/.hg/00changelog.i ]; then
35 echo 00changelog.i created
36 fi
51 $ hg --config format.usestore=false init old
52 $ checknewrepo old
53 revlogv1
54
55 creating repo with format.usefncache=false
37 56
38 cat $name/.hg/requires
39 }
57 $ hg --config format.usefncache=false init old2
58 $ checknewrepo old2
59 store created
60 00changelog.i created
61 revlogv1
62 store
40 63
41 echo "# creating 'local'"
42 hg init local
43 checknewrepo local
44 echo this > local/foo
45 hg ci --cwd local -A -m "init" -d "1000000 0"
64 test failure
65
66 $ hg init local
67 abort: repository local already exists!
68
69 init+push to remote2
46 70
47 echo "# creating repo with format.usestore=false"
48 hg --config format.usestore=false init old
49 checknewrepo old
71 $ hg init -e "python ./dummyssh" ssh://user@dummy/remote2
72 $ hg incoming -R remote2 local
73 comparing with local
74 changeset: 0:c4e059d443be
75 tag: tip
76 user: test
77 date: Mon Jan 12 13:46:40 1970 +0000
78 summary: init
79
50 80
51 echo "# creating repo with format.usefncache=false"
52 hg --config format.usefncache=false init old2
53 checknewrepo old2
81 $ hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2
82 pushing to ssh://user@dummy/remote2
83 searching for changes
84 remote: adding changesets
85 remote: adding manifests
86 remote: adding file changes
87 remote: added 1 changesets with 1 changes to 1 files
54 88
55 echo "#test failure"
56 hg init local
89 clone to remote1
57 90
58 echo "# init+push to remote2"
59 hg init -e "python ./dummyssh" ssh://user@dummy/remote2
60 hg incoming -R remote2 local
61 hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2
91 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
92 searching for changes
93 remote: adding changesets
94 remote: adding manifests
95 remote: adding file changes
96 remote: added 1 changesets with 1 changes to 1 files
97
98 init to existing repo
62 99
63 echo "# clone to remote1"
64 hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
100 $ hg init -e "python ./dummyssh" ssh://user@dummy/remote1
101 abort: repository remote1 already exists!
102 abort: could not create remote repo!
103
104 clone to existing repo
65 105
66 echo "# init to existing repo"
67 hg init -e "python ./dummyssh" ssh://user@dummy/remote1
106 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
107 abort: repository remote1 already exists!
108 abort: could not create remote repo!
109
110 output of dummyssh
68 111
69 echo "# clone to existing repo"
70 hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
112 $ cat dummylog
113 Got arguments 1:user@dummy 2:hg init remote2
114 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
115 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
116 Got arguments 1:user@dummy 2:hg init remote1
117 Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio
118 Got arguments 1:user@dummy 2:hg init remote1
119 Got arguments 1:user@dummy 2:hg init remote1
71 120
72 echo "# output of dummyssh"
73 cat dummylog
121 comparing repositories
74 122
75 echo "# comparing repositories"
76 hg tip -q -R local
77 hg tip -q -R remote1
78 hg tip -q -R remote2
123 $ hg tip -q -R local
124 0:c4e059d443be
125 $ hg tip -q -R remote1
126 0:c4e059d443be
127 $ hg tip -q -R remote2
128 0:c4e059d443be
129
130 check names for repositories (clashes with URL schemes, special chars)
79 131
80 echo "# check names for repositories (clashes with URL schemes, special chars)"
81 for i in bundle file hg http https old-http ssh static-http " " "with space"; do
82 echo "# hg init \"$i\""
83 hg init "$i"
84 test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
85 done
132 $ for i in bundle file hg http https old-http ssh static-http " " "with space"; do
133 > echo -n "hg init \"$i\"... "
134 > hg init "$i"
135 > test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
136 > done
137 hg init "bundle"... ok
138 hg init "file"... ok
139 hg init "hg"... ok
140 hg init "http"... ok
141 hg init "https"... ok
142 hg init "old-http"... ok
143 hg init "ssh"... ok
144 hg init "static-http"... ok
145 hg init " "... ok
146 hg init "with space"... ok
86 147
87 echo "# creating 'local/sub/repo'"
88 hg init local/sub/repo
89 checknewrepo local/sub/repo
148 creating 'local/sub/repo'
149
150 $ hg init local/sub/repo
151 $ checknewrepo local/sub/repo
152 store created
153 00changelog.i created
154 revlogv1
155 store
156 fncache
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now