##// 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 # This test tries to exercise the ssh functionality with a dummy script
1 # This test tries to exercise the ssh functionality with a dummy script
4
2
5 cat <<EOF > dummyssh
3 $ cat <<EOF > dummyssh
6 import sys
4 > import sys
7 import os
5 > import os
8
6 >
9 os.chdir(os.path.dirname(sys.argv[0]))
7 > os.chdir(os.path.dirname(sys.argv[0]))
10 if sys.argv[1] != "user@dummy":
8 > if sys.argv[1] != "user@dummy":
11 sys.exit(-1)
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"):
24 $ checknewrepo()
14 sys.exit(-1)
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 > }
15
35
16 log = open("dummylog", "ab")
36 creating 'local'
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
25
37
26 checknewrepo()
38 $ hg init local
27 {
39 $ checknewrepo local
28 name=$1
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
29
48
30 if [ -d $name/.hg/store ]; then
49 creating repo with format.usestore=false
31 echo store created
50
32 fi
51 $ hg --config format.usestore=false init old
52 $ checknewrepo old
53 revlogv1
54
55 creating repo with format.usefncache=false
33
56
34 if [ -f $name/.hg/00changelog.i ]; then
57 $ hg --config format.usefncache=false init old2
35 echo 00changelog.i created
58 $ checknewrepo old2
36 fi
59 store created
60 00changelog.i created
61 revlogv1
62 store
63
64 test failure
37
65
38 cat $name/.hg/requires
66 $ hg init local
39 }
67 abort: repository local already exists!
68
69 init+push to remote2
40
70
41 echo "# creating 'local'"
71 $ hg init -e "python ./dummyssh" ssh://user@dummy/remote2
42 hg init local
72 $ hg incoming -R remote2 local
43 checknewrepo local
73 comparing with local
44 echo this > local/foo
74 changeset: 0:c4e059d443be
45 hg ci --cwd local -A -m "init" -d "1000000 0"
75 tag: tip
76 user: test
77 date: Mon Jan 12 13:46:40 1970 +0000
78 summary: init
46
79
47 echo "# creating repo with format.usestore=false"
48 hg --config format.usestore=false init old
49 checknewrepo old
50
80
51 echo "# creating repo with format.usefncache=false"
81 $ hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2
52 hg --config format.usefncache=false init old2
82 pushing to ssh://user@dummy/remote2
53 checknewrepo old2
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"
89 clone to remote1
56 hg init local
57
90
58 echo "# init+push to remote2"
91 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
59 hg init -e "python ./dummyssh" ssh://user@dummy/remote2
92 searching for changes
60 hg incoming -R remote2 local
93 remote: adding changesets
61 hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2
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"
100 $ hg init -e "python ./dummyssh" ssh://user@dummy/remote1
64 hg clone -e "python ./dummyssh" local 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"
106 $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
67 hg init -e "python ./dummyssh" 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"
112 $ cat dummylog
70 hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1
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"
121 comparing repositories
73 cat dummylog
74
122
75 echo "# comparing repositories"
123 $ hg tip -q -R local
76 hg tip -q -R local
124 0:c4e059d443be
77 hg tip -q -R remote1
125 $ hg tip -q -R remote1
78 hg tip -q -R remote2
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)"
132 $ for i in bundle file hg http https old-http ssh static-http " " "with space"; do
81 for i in bundle file hg http https old-http ssh static-http " " "with space"; do
133 > echo -n "hg init \"$i\"... "
82 echo "# hg init \"$i\""
134 > hg init "$i"
83 hg init "$i"
135 > test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
84 test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
136 > done
85 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'"
148 creating 'local/sub/repo'
88 hg init local/sub/repo
149
89 checknewrepo local/sub/repo
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now