##// END OF EJS Templates
sshrepo: don't quote obviously safe strings (issue2983)...
Mads Kiilerich -
r15622:86fc364c default
parent child Browse files
Show More
@@ -1,229 +1,232 b''
1 # sshrepo.py - ssh repository proxy class for mercurial
1 # sshrepo.py - ssh repository proxy class for mercurial
2 #
2 #
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import re
8 from i18n import _
9 from i18n import _
9 import util, error, wireproto
10 import util, error, wireproto
10
11
11 class remotelock(object):
12 class remotelock(object):
12 def __init__(self, repo):
13 def __init__(self, repo):
13 self.repo = repo
14 self.repo = repo
14 def release(self):
15 def release(self):
15 self.repo.unlock()
16 self.repo.unlock()
16 self.repo = None
17 self.repo = None
17 def __del__(self):
18 def __del__(self):
18 if self.repo:
19 if self.repo:
19 self.release()
20 self.release()
20
21
21 def _serverquote(s):
22 def _serverquote(s):
22 '''quote a string for the remote shell ... which we assume is sh'''
23 '''quote a string for the remote shell ... which we assume is sh'''
24 if re.match(r'[a-zA-Z0-9._\-/]*$', s):
25 return s
23 return "'%s'" % s.replace("'", "'\\''")
26 return "'%s'" % s.replace("'", "'\\''")
24
27
25 class sshrepository(wireproto.wirerepository):
28 class sshrepository(wireproto.wirerepository):
26 def __init__(self, ui, path, create=False):
29 def __init__(self, ui, path, create=False):
27 self._url = path
30 self._url = path
28 self.ui = ui
31 self.ui = ui
29
32
30 u = util.url(path, parsequery=False, parsefragment=False)
33 u = util.url(path, parsequery=False, parsefragment=False)
31 if u.scheme != 'ssh' or not u.host or u.path is None:
34 if u.scheme != 'ssh' or not u.host or u.path is None:
32 self._abort(error.RepoError(_("couldn't parse location %s") % path))
35 self._abort(error.RepoError(_("couldn't parse location %s") % path))
33
36
34 self.user = u.user
37 self.user = u.user
35 if u.passwd is not None:
38 if u.passwd is not None:
36 self._abort(error.RepoError(_("password in URL not supported")))
39 self._abort(error.RepoError(_("password in URL not supported")))
37 self.host = u.host
40 self.host = u.host
38 self.port = u.port
41 self.port = u.port
39 self.path = u.path or "."
42 self.path = u.path or "."
40
43
41 sshcmd = self.ui.config("ui", "ssh", "ssh")
44 sshcmd = self.ui.config("ui", "ssh", "ssh")
42 remotecmd = self.ui.config("ui", "remotecmd", "hg")
45 remotecmd = self.ui.config("ui", "remotecmd", "hg")
43
46
44 args = util.sshargs(sshcmd, self.host, self.user, self.port)
47 args = util.sshargs(sshcmd, self.host, self.user, self.port)
45
48
46 if create:
49 if create:
47 cmd = '%s %s %s' % (sshcmd, args,
50 cmd = '%s %s %s' % (sshcmd, args,
48 util.shellquote("%s init %s" %
51 util.shellquote("%s init %s" %
49 (_serverquote(remotecmd), _serverquote(self.path))))
52 (_serverquote(remotecmd), _serverquote(self.path))))
50 ui.note(_('running %s\n') % cmd)
53 ui.note(_('running %s\n') % cmd)
51 res = util.system(cmd)
54 res = util.system(cmd)
52 if res != 0:
55 if res != 0:
53 self._abort(error.RepoError(_("could not create remote repo")))
56 self._abort(error.RepoError(_("could not create remote repo")))
54
57
55 self.validate_repo(ui, sshcmd, args, remotecmd)
58 self.validate_repo(ui, sshcmd, args, remotecmd)
56
59
57 def url(self):
60 def url(self):
58 return self._url
61 return self._url
59
62
60 def validate_repo(self, ui, sshcmd, args, remotecmd):
63 def validate_repo(self, ui, sshcmd, args, remotecmd):
61 # cleanup up previous run
64 # cleanup up previous run
62 self.cleanup()
65 self.cleanup()
63
66
64 cmd = '%s %s %s' % (sshcmd, args,
67 cmd = '%s %s %s' % (sshcmd, args,
65 util.shellquote("%s -R %s serve --stdio" %
68 util.shellquote("%s -R %s serve --stdio" %
66 (_serverquote(remotecmd), _serverquote(self.path))))
69 (_serverquote(remotecmd), _serverquote(self.path))))
67 ui.note(_('running %s\n') % cmd)
70 ui.note(_('running %s\n') % cmd)
68 cmd = util.quotecommand(cmd)
71 cmd = util.quotecommand(cmd)
69 self.pipeo, self.pipei, self.pipee = util.popen3(cmd)
72 self.pipeo, self.pipei, self.pipee = util.popen3(cmd)
70
73
71 # skip any noise generated by remote shell
74 # skip any noise generated by remote shell
72 self._callstream("hello")
75 self._callstream("hello")
73 r = self._callstream("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
76 r = self._callstream("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
74 lines = ["", "dummy"]
77 lines = ["", "dummy"]
75 max_noise = 500
78 max_noise = 500
76 while lines[-1] and max_noise:
79 while lines[-1] and max_noise:
77 l = r.readline()
80 l = r.readline()
78 self.readerr()
81 self.readerr()
79 if lines[-1] == "1\n" and l == "\n":
82 if lines[-1] == "1\n" and l == "\n":
80 break
83 break
81 if l:
84 if l:
82 ui.debug("remote: ", l)
85 ui.debug("remote: ", l)
83 lines.append(l)
86 lines.append(l)
84 max_noise -= 1
87 max_noise -= 1
85 else:
88 else:
86 self._abort(error.RepoError(_("no suitable response from remote hg")))
89 self._abort(error.RepoError(_("no suitable response from remote hg")))
87
90
88 self.capabilities = set()
91 self.capabilities = set()
89 for l in reversed(lines):
92 for l in reversed(lines):
90 if l.startswith("capabilities:"):
93 if l.startswith("capabilities:"):
91 self.capabilities.update(l[:-1].split(":")[1].split())
94 self.capabilities.update(l[:-1].split(":")[1].split())
92 break
95 break
93
96
94 def readerr(self):
97 def readerr(self):
95 while True:
98 while True:
96 size = util.fstat(self.pipee).st_size
99 size = util.fstat(self.pipee).st_size
97 if size == 0:
100 if size == 0:
98 break
101 break
99 s = self.pipee.read(size)
102 s = self.pipee.read(size)
100 if not s:
103 if not s:
101 break
104 break
102 for l in s.splitlines():
105 for l in s.splitlines():
103 self.ui.status(_("remote: "), l, '\n')
106 self.ui.status(_("remote: "), l, '\n')
104
107
105 def _abort(self, exception):
108 def _abort(self, exception):
106 self.cleanup()
109 self.cleanup()
107 raise exception
110 raise exception
108
111
109 def cleanup(self):
112 def cleanup(self):
110 try:
113 try:
111 self.pipeo.close()
114 self.pipeo.close()
112 self.pipei.close()
115 self.pipei.close()
113 # read the error descriptor until EOF
116 # read the error descriptor until EOF
114 for l in self.pipee:
117 for l in self.pipee:
115 self.ui.status(_("remote: "), l)
118 self.ui.status(_("remote: "), l)
116 self.pipee.close()
119 self.pipee.close()
117 except:
120 except:
118 pass
121 pass
119
122
120 __del__ = cleanup
123 __del__ = cleanup
121
124
122 def _callstream(self, cmd, **args):
125 def _callstream(self, cmd, **args):
123 self.ui.debug("sending %s command\n" % cmd)
126 self.ui.debug("sending %s command\n" % cmd)
124 self.pipeo.write("%s\n" % cmd)
127 self.pipeo.write("%s\n" % cmd)
125 _func, names = wireproto.commands[cmd]
128 _func, names = wireproto.commands[cmd]
126 keys = names.split()
129 keys = names.split()
127 wireargs = {}
130 wireargs = {}
128 for k in keys:
131 for k in keys:
129 if k == '*':
132 if k == '*':
130 wireargs['*'] = args
133 wireargs['*'] = args
131 break
134 break
132 else:
135 else:
133 wireargs[k] = args[k]
136 wireargs[k] = args[k]
134 del args[k]
137 del args[k]
135 for k, v in sorted(wireargs.iteritems()):
138 for k, v in sorted(wireargs.iteritems()):
136 self.pipeo.write("%s %d\n" % (k, len(v)))
139 self.pipeo.write("%s %d\n" % (k, len(v)))
137 if isinstance(v, dict):
140 if isinstance(v, dict):
138 for dk, dv in v.iteritems():
141 for dk, dv in v.iteritems():
139 self.pipeo.write("%s %d\n" % (dk, len(dv)))
142 self.pipeo.write("%s %d\n" % (dk, len(dv)))
140 self.pipeo.write(dv)
143 self.pipeo.write(dv)
141 else:
144 else:
142 self.pipeo.write(v)
145 self.pipeo.write(v)
143 self.pipeo.flush()
146 self.pipeo.flush()
144
147
145 return self.pipei
148 return self.pipei
146
149
147 def _call(self, cmd, **args):
150 def _call(self, cmd, **args):
148 self._callstream(cmd, **args)
151 self._callstream(cmd, **args)
149 return self._recv()
152 return self._recv()
150
153
151 def _callpush(self, cmd, fp, **args):
154 def _callpush(self, cmd, fp, **args):
152 r = self._call(cmd, **args)
155 r = self._call(cmd, **args)
153 if r:
156 if r:
154 return '', r
157 return '', r
155 while True:
158 while True:
156 d = fp.read(4096)
159 d = fp.read(4096)
157 if not d:
160 if not d:
158 break
161 break
159 self._send(d)
162 self._send(d)
160 self._send("", flush=True)
163 self._send("", flush=True)
161 r = self._recv()
164 r = self._recv()
162 if r:
165 if r:
163 return '', r
166 return '', r
164 return self._recv(), ''
167 return self._recv(), ''
165
168
166 def _decompress(self, stream):
169 def _decompress(self, stream):
167 return stream
170 return stream
168
171
169 def _recv(self):
172 def _recv(self):
170 l = self.pipei.readline()
173 l = self.pipei.readline()
171 if l == '\n':
174 if l == '\n':
172 err = []
175 err = []
173 while True:
176 while True:
174 line = self.pipee.readline()
177 line = self.pipee.readline()
175 if line == '-\n':
178 if line == '-\n':
176 break
179 break
177 err.extend([line])
180 err.extend([line])
178 if len(err) > 0:
181 if len(err) > 0:
179 # strip the trailing newline added to the last line server-side
182 # strip the trailing newline added to the last line server-side
180 err[-1] = err[-1][:-1]
183 err[-1] = err[-1][:-1]
181 self._abort(error.OutOfBandError(*err))
184 self._abort(error.OutOfBandError(*err))
182 self.readerr()
185 self.readerr()
183 try:
186 try:
184 l = int(l)
187 l = int(l)
185 except ValueError:
188 except ValueError:
186 self._abort(error.ResponseError(_("unexpected response:"), l))
189 self._abort(error.ResponseError(_("unexpected response:"), l))
187 return self.pipei.read(l)
190 return self.pipei.read(l)
188
191
189 def _send(self, data, flush=False):
192 def _send(self, data, flush=False):
190 self.pipeo.write("%d\n" % len(data))
193 self.pipeo.write("%d\n" % len(data))
191 if data:
194 if data:
192 self.pipeo.write(data)
195 self.pipeo.write(data)
193 if flush:
196 if flush:
194 self.pipeo.flush()
197 self.pipeo.flush()
195 self.readerr()
198 self.readerr()
196
199
197 def lock(self):
200 def lock(self):
198 self._call("lock")
201 self._call("lock")
199 return remotelock(self)
202 return remotelock(self)
200
203
201 def unlock(self):
204 def unlock(self):
202 self._call("unlock")
205 self._call("unlock")
203
206
204 def addchangegroup(self, cg, source, url, lock=None):
207 def addchangegroup(self, cg, source, url, lock=None):
205 '''Send a changegroup to the remote server. Return an integer
208 '''Send a changegroup to the remote server. Return an integer
206 similar to unbundle(). DEPRECATED, since it requires locking the
209 similar to unbundle(). DEPRECATED, since it requires locking the
207 remote.'''
210 remote.'''
208 d = self._call("addchangegroup")
211 d = self._call("addchangegroup")
209 if d:
212 if d:
210 self._abort(error.RepoError(_("push refused: %s") % d))
213 self._abort(error.RepoError(_("push refused: %s") % d))
211 while True:
214 while True:
212 d = cg.read(4096)
215 d = cg.read(4096)
213 if not d:
216 if not d:
214 break
217 break
215 self.pipeo.write(d)
218 self.pipeo.write(d)
216 self.readerr()
219 self.readerr()
217
220
218 self.pipeo.flush()
221 self.pipeo.flush()
219
222
220 self.readerr()
223 self.readerr()
221 r = self._recv()
224 r = self._recv()
222 if not r:
225 if not r:
223 return 1
226 return 1
224 try:
227 try:
225 return int(r)
228 return int(r)
226 except ValueError:
229 except ValueError:
227 self._abort(error.ResponseError(_("unexpected response:"), r))
230 self._abort(error.ResponseError(_("unexpected response:"), r))
228
231
229 instance = sshrepository
232 instance = sshrepository
@@ -1,196 +1,196 b''
1 $ "$TESTDIR/hghave" no-windows || exit 80
1 $ "$TESTDIR/hghave" no-windows || exit 80
2
2
3 This test tries to exercise the ssh functionality with a dummy script
3 This test tries to exercise the ssh functionality with a dummy script
4
4
5 $ checknewrepo()
5 $ checknewrepo()
6 > {
6 > {
7 > name=$1
7 > name=$1
8 > if [ -d "$name"/.hg/store ]; then
8 > if [ -d "$name"/.hg/store ]; then
9 > echo store created
9 > echo store created
10 > fi
10 > fi
11 > if [ -f "$name"/.hg/00changelog.i ]; then
11 > if [ -f "$name"/.hg/00changelog.i ]; then
12 > echo 00changelog.i created
12 > echo 00changelog.i created
13 > fi
13 > fi
14 > cat "$name"/.hg/requires
14 > cat "$name"/.hg/requires
15 > }
15 > }
16
16
17 creating 'local'
17 creating 'local'
18
18
19 $ hg init local
19 $ hg init local
20 $ checknewrepo local
20 $ checknewrepo local
21 store created
21 store created
22 00changelog.i created
22 00changelog.i created
23 revlogv1
23 revlogv1
24 fncache
24 fncache
25 store
25 store
26 dotencode
26 dotencode
27 $ echo this > local/foo
27 $ echo this > local/foo
28 $ hg ci --cwd local -A -m "init"
28 $ hg ci --cwd local -A -m "init"
29 adding foo
29 adding foo
30
30
31 creating repo with format.usestore=false
31 creating repo with format.usestore=false
32
32
33 $ hg --config format.usestore=false init old
33 $ hg --config format.usestore=false init old
34 $ checknewrepo old
34 $ checknewrepo old
35 revlogv1
35 revlogv1
36
36
37 creating repo with format.usefncache=false
37 creating repo with format.usefncache=false
38
38
39 $ hg --config format.usefncache=false init old2
39 $ hg --config format.usefncache=false init old2
40 $ checknewrepo old2
40 $ checknewrepo old2
41 store created
41 store created
42 00changelog.i created
42 00changelog.i created
43 revlogv1
43 revlogv1
44 store
44 store
45
45
46 creating repo with format.dotencode=false
46 creating repo with format.dotencode=false
47
47
48 $ hg --config format.dotencode=false init old3
48 $ hg --config format.dotencode=false init old3
49 $ checknewrepo old3
49 $ checknewrepo old3
50 store created
50 store created
51 00changelog.i created
51 00changelog.i created
52 revlogv1
52 revlogv1
53 fncache
53 fncache
54 store
54 store
55
55
56 test failure
56 test failure
57
57
58 $ hg init local
58 $ hg init local
59 abort: repository local already exists!
59 abort: repository local already exists!
60 [255]
60 [255]
61
61
62 init+push to remote2
62 init+push to remote2
63
63
64 $ hg init -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote2
64 $ hg init -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote2
65 $ hg incoming -R remote2 local
65 $ hg incoming -R remote2 local
66 comparing with local
66 comparing with local
67 changeset: 0:08b9e9f63b32
67 changeset: 0:08b9e9f63b32
68 tag: tip
68 tag: tip
69 user: test
69 user: test
70 date: Thu Jan 01 00:00:00 1970 +0000
70 date: Thu Jan 01 00:00:00 1970 +0000
71 summary: init
71 summary: init
72
72
73
73
74 $ hg push -R local -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote2
74 $ hg push -R local -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote2
75 pushing to ssh://user@dummy/remote2
75 pushing to ssh://user@dummy/remote2
76 searching for changes
76 searching for changes
77 remote: adding changesets
77 remote: adding changesets
78 remote: adding manifests
78 remote: adding manifests
79 remote: adding file changes
79 remote: adding file changes
80 remote: added 1 changesets with 1 changes to 1 files
80 remote: added 1 changesets with 1 changes to 1 files
81
81
82 clone to remote1
82 clone to remote1
83
83
84 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote1
84 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote1
85 searching for changes
85 searching for changes
86 remote: adding changesets
86 remote: adding changesets
87 remote: adding manifests
87 remote: adding manifests
88 remote: adding file changes
88 remote: adding file changes
89 remote: added 1 changesets with 1 changes to 1 files
89 remote: added 1 changesets with 1 changes to 1 files
90
90
91 init to existing repo
91 init to existing repo
92
92
93 $ hg init -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote1
93 $ hg init -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote1
94 abort: repository remote1 already exists!
94 abort: repository remote1 already exists!
95 abort: could not create remote repo!
95 abort: could not create remote repo!
96 [255]
96 [255]
97
97
98 clone to existing repo
98 clone to existing repo
99
99
100 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote1
100 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote1
101 abort: repository remote1 already exists!
101 abort: repository remote1 already exists!
102 abort: could not create remote repo!
102 abort: could not create remote repo!
103 [255]
103 [255]
104
104
105 output of dummyssh
105 output of dummyssh
106
106
107 $ cat dummylog
107 $ cat dummylog
108 Got arguments 1:user@dummy 2:'hg' init 'remote2'
108 Got arguments 1:user@dummy 2:hg init remote2
109 Got arguments 1:user@dummy 2:'hg' -R 'remote2' serve --stdio
109 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
110 Got arguments 1:user@dummy 2:'hg' -R 'remote2' serve --stdio
110 Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
111 Got arguments 1:user@dummy 2:'hg' init 'remote1'
111 Got arguments 1:user@dummy 2:hg init remote1
112 Got arguments 1:user@dummy 2:'hg' -R 'remote1' serve --stdio
112 Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio
113 Got arguments 1:user@dummy 2:'hg' init 'remote1'
113 Got arguments 1:user@dummy 2:hg init remote1
114 Got arguments 1:user@dummy 2:'hg' init 'remote1'
114 Got arguments 1:user@dummy 2:hg init remote1
115
115
116 comparing repositories
116 comparing repositories
117
117
118 $ hg tip -q -R local
118 $ hg tip -q -R local
119 0:08b9e9f63b32
119 0:08b9e9f63b32
120 $ hg tip -q -R remote1
120 $ hg tip -q -R remote1
121 0:08b9e9f63b32
121 0:08b9e9f63b32
122 $ hg tip -q -R remote2
122 $ hg tip -q -R remote2
123 0:08b9e9f63b32
123 0:08b9e9f63b32
124
124
125 check names for repositories (clashes with URL schemes, special chars)
125 check names for repositories (clashes with URL schemes, special chars)
126
126
127 $ for i in bundle file hg http https old-http ssh static-http " " "with space"; do
127 $ for i in bundle file hg http https old-http ssh static-http " " "with space"; do
128 > printf "hg init \"$i\"... "
128 > printf "hg init \"$i\"... "
129 > hg init "$i"
129 > hg init "$i"
130 > test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
130 > test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
131 > done
131 > done
132 hg init "bundle"... ok
132 hg init "bundle"... ok
133 hg init "file"... ok
133 hg init "file"... ok
134 hg init "hg"... ok
134 hg init "hg"... ok
135 hg init "http"... ok
135 hg init "http"... ok
136 hg init "https"... ok
136 hg init "https"... ok
137 hg init "old-http"... ok
137 hg init "old-http"... ok
138 hg init "ssh"... ok
138 hg init "ssh"... ok
139 hg init "static-http"... ok
139 hg init "static-http"... ok
140 hg init " "... ok
140 hg init " "... ok
141 hg init "with space"... ok
141 hg init "with space"... ok
142
142
143 creating 'local/sub/repo'
143 creating 'local/sub/repo'
144
144
145 $ hg init local/sub/repo
145 $ hg init local/sub/repo
146 $ checknewrepo local/sub/repo
146 $ checknewrepo local/sub/repo
147 store created
147 store created
148 00changelog.i created
148 00changelog.i created
149 revlogv1
149 revlogv1
150 fncache
150 fncache
151 store
151 store
152 dotencode
152 dotencode
153
153
154 prepare test of init of url configured from paths
154 prepare test of init of url configured from paths
155
155
156 $ echo '[paths]' >> $HGRCPATH
156 $ echo '[paths]' >> $HGRCPATH
157 $ echo "somewhere = `pwd`/url from paths" >> $HGRCPATH
157 $ echo "somewhere = `pwd`/url from paths" >> $HGRCPATH
158 $ echo "elsewhere = `pwd`/another paths url" >> $HGRCPATH
158 $ echo "elsewhere = `pwd`/another paths url" >> $HGRCPATH
159
159
160 init should (for consistency with clone) expand the url
160 init should (for consistency with clone) expand the url
161
161
162 $ hg init somewhere
162 $ hg init somewhere
163 $ checknewrepo "url from paths"
163 $ checknewrepo "url from paths"
164 store created
164 store created
165 00changelog.i created
165 00changelog.i created
166 revlogv1
166 revlogv1
167 fncache
167 fncache
168 store
168 store
169 dotencode
169 dotencode
170
170
171 verify that clone also expand urls
171 verify that clone also expand urls
172
172
173 $ hg clone somewhere elsewhere
173 $ hg clone somewhere elsewhere
174 updating to branch default
174 updating to branch default
175 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 $ checknewrepo "another paths url"
176 $ checknewrepo "another paths url"
177 store created
177 store created
178 00changelog.i created
178 00changelog.i created
179 revlogv1
179 revlogv1
180 fncache
180 fncache
181 store
181 store
182 dotencode
182 dotencode
183
183
184 clone bookmarks
184 clone bookmarks
185
185
186 $ hg -R local bookmark test
186 $ hg -R local bookmark test
187 $ hg -R local bookmarks
187 $ hg -R local bookmarks
188 * test 0:08b9e9f63b32
188 * test 0:08b9e9f63b32
189 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote-bookmarks
189 $ hg clone -e "python $TESTDIR/dummyssh" local ssh://user@dummy/remote-bookmarks
190 searching for changes
190 searching for changes
191 remote: adding changesets
191 remote: adding changesets
192 remote: adding manifests
192 remote: adding manifests
193 remote: adding file changes
193 remote: adding file changes
194 remote: added 1 changesets with 1 changes to 1 files
194 remote: added 1 changesets with 1 changes to 1 files
195 $ hg -R remote-bookmarks bookmarks
195 $ hg -R remote-bookmarks bookmarks
196 test 0:08b9e9f63b32
196 test 0:08b9e9f63b32
@@ -1,301 +1,301 b''
1
1
2
2
3 This test tries to exercise the ssh functionality with a dummy script
3 This test tries to exercise the ssh functionality with a dummy script
4
4
5 creating 'remote' repo
5 creating 'remote' repo
6
6
7 $ hg init remote
7 $ hg init remote
8 $ cd remote
8 $ cd remote
9 $ echo this > foo
9 $ echo this > foo
10 $ echo this > fooO
10 $ echo this > fooO
11 $ hg ci -A -m "init" foo fooO
11 $ hg ci -A -m "init" foo fooO
12 $ cat <<EOF > .hg/hgrc
12 $ cat <<EOF > .hg/hgrc
13 > [server]
13 > [server]
14 > uncompressed = True
14 > uncompressed = True
15 >
15 >
16 > [hooks]
16 > [hooks]
17 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
17 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
18 > EOF
18 > EOF
19 $ cd ..
19 $ cd ..
20
20
21 repo not found error
21 repo not found error
22
22
23 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/nonexistent local
23 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/nonexistent local
24 remote: abort: There is no Mercurial repository here (.hg not found)!
24 remote: abort: There is no Mercurial repository here (.hg not found)!
25 abort: no suitable response from remote hg!
25 abort: no suitable response from remote hg!
26 [255]
26 [255]
27
27
28 non-existent absolute path
28 non-existent absolute path
29
29
30 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy//`pwd`/nonexistent local
30 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy//`pwd`/nonexistent local
31 remote: abort: There is no Mercurial repository here (.hg not found)!
31 remote: abort: There is no Mercurial repository here (.hg not found)!
32 abort: no suitable response from remote hg!
32 abort: no suitable response from remote hg!
33 [255]
33 [255]
34
34
35 clone remote via stream
35 clone remote via stream
36
36
37 $ hg clone -e "python $TESTDIR/dummyssh" --uncompressed ssh://user@dummy/remote local-stream
37 $ hg clone -e "python $TESTDIR/dummyssh" --uncompressed ssh://user@dummy/remote local-stream
38 streaming all changes
38 streaming all changes
39 4 files to transfer, 392 bytes of data
39 4 files to transfer, 392 bytes of data
40 transferred 392 bytes in * seconds (*/sec) (glob)
40 transferred 392 bytes in * seconds (*/sec) (glob)
41 updating to branch default
41 updating to branch default
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ cd local-stream
43 $ cd local-stream
44 $ hg verify
44 $ hg verify
45 checking changesets
45 checking changesets
46 checking manifests
46 checking manifests
47 crosschecking files in changesets and manifests
47 crosschecking files in changesets and manifests
48 checking files
48 checking files
49 2 files, 1 changesets, 2 total revisions
49 2 files, 1 changesets, 2 total revisions
50 $ cd ..
50 $ cd ..
51
51
52 clone remote via pull
52 clone remote via pull
53
53
54 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote local
54 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote local
55 requesting all changes
55 requesting all changes
56 adding changesets
56 adding changesets
57 adding manifests
57 adding manifests
58 adding file changes
58 adding file changes
59 added 1 changesets with 2 changes to 2 files
59 added 1 changesets with 2 changes to 2 files
60 updating to branch default
60 updating to branch default
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62
62
63 verify
63 verify
64
64
65 $ cd local
65 $ cd local
66 $ hg verify
66 $ hg verify
67 checking changesets
67 checking changesets
68 checking manifests
68 checking manifests
69 crosschecking files in changesets and manifests
69 crosschecking files in changesets and manifests
70 checking files
70 checking files
71 2 files, 1 changesets, 2 total revisions
71 2 files, 1 changesets, 2 total revisions
72 $ echo '[hooks]' >> .hg/hgrc
72 $ echo '[hooks]' >> .hg/hgrc
73 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
73 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
74
74
75 empty default pull
75 empty default pull
76
76
77 $ hg paths
77 $ hg paths
78 default = ssh://user@dummy/remote
78 default = ssh://user@dummy/remote
79 $ hg pull -e "python $TESTDIR/dummyssh"
79 $ hg pull -e "python $TESTDIR/dummyssh"
80 pulling from ssh://user@dummy/remote
80 pulling from ssh://user@dummy/remote
81 searching for changes
81 searching for changes
82 no changes found
82 no changes found
83
83
84 local change
84 local change
85
85
86 $ echo bleah > foo
86 $ echo bleah > foo
87 $ hg ci -m "add"
87 $ hg ci -m "add"
88
88
89 updating rc
89 updating rc
90
90
91 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
91 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
92 $ echo "[ui]" >> .hg/hgrc
92 $ echo "[ui]" >> .hg/hgrc
93 $ echo "ssh = python $TESTDIR/dummyssh" >> .hg/hgrc
93 $ echo "ssh = python $TESTDIR/dummyssh" >> .hg/hgrc
94
94
95 find outgoing
95 find outgoing
96
96
97 $ hg out ssh://user@dummy/remote
97 $ hg out ssh://user@dummy/remote
98 comparing with ssh://user@dummy/remote
98 comparing with ssh://user@dummy/remote
99 searching for changes
99 searching for changes
100 changeset: 1:a28a9d1a809c
100 changeset: 1:a28a9d1a809c
101 tag: tip
101 tag: tip
102 user: test
102 user: test
103 date: Thu Jan 01 00:00:00 1970 +0000
103 date: Thu Jan 01 00:00:00 1970 +0000
104 summary: add
104 summary: add
105
105
106
106
107 find incoming on the remote side
107 find incoming on the remote side
108
108
109 $ hg incoming -R ../remote -e "python $TESTDIR/dummyssh" ssh://user@dummy/local
109 $ hg incoming -R ../remote -e "python $TESTDIR/dummyssh" ssh://user@dummy/local
110 comparing with ssh://user@dummy/local
110 comparing with ssh://user@dummy/local
111 searching for changes
111 searching for changes
112 changeset: 1:a28a9d1a809c
112 changeset: 1:a28a9d1a809c
113 tag: tip
113 tag: tip
114 user: test
114 user: test
115 date: Thu Jan 01 00:00:00 1970 +0000
115 date: Thu Jan 01 00:00:00 1970 +0000
116 summary: add
116 summary: add
117
117
118
118
119 find incoming on the remote side (using absolute path)
119 find incoming on the remote side (using absolute path)
120
120
121 $ hg incoming -R ../remote -e "python $TESTDIR/dummyssh" "ssh://user@dummy/`pwd`"
121 $ hg incoming -R ../remote -e "python $TESTDIR/dummyssh" "ssh://user@dummy/`pwd`"
122 comparing with ssh://user@dummy/$TESTTMP/local
122 comparing with ssh://user@dummy/$TESTTMP/local
123 searching for changes
123 searching for changes
124 changeset: 1:a28a9d1a809c
124 changeset: 1:a28a9d1a809c
125 tag: tip
125 tag: tip
126 user: test
126 user: test
127 date: Thu Jan 01 00:00:00 1970 +0000
127 date: Thu Jan 01 00:00:00 1970 +0000
128 summary: add
128 summary: add
129
129
130
130
131 push
131 push
132
132
133 $ hg push
133 $ hg push
134 pushing to ssh://user@dummy/remote
134 pushing to ssh://user@dummy/remote
135 searching for changes
135 searching for changes
136 remote: adding changesets
136 remote: adding changesets
137 remote: adding manifests
137 remote: adding manifests
138 remote: adding file changes
138 remote: adding file changes
139 remote: added 1 changesets with 1 changes to 1 files
139 remote: added 1 changesets with 1 changes to 1 files
140 $ cd ../remote
140 $ cd ../remote
141
141
142 check remote tip
142 check remote tip
143
143
144 $ hg tip
144 $ hg tip
145 changeset: 1:a28a9d1a809c
145 changeset: 1:a28a9d1a809c
146 tag: tip
146 tag: tip
147 user: test
147 user: test
148 date: Thu Jan 01 00:00:00 1970 +0000
148 date: Thu Jan 01 00:00:00 1970 +0000
149 summary: add
149 summary: add
150
150
151 $ hg verify
151 $ hg verify
152 checking changesets
152 checking changesets
153 checking manifests
153 checking manifests
154 crosschecking files in changesets and manifests
154 crosschecking files in changesets and manifests
155 checking files
155 checking files
156 2 files, 2 changesets, 3 total revisions
156 2 files, 2 changesets, 3 total revisions
157 $ hg cat -r tip foo
157 $ hg cat -r tip foo
158 bleah
158 bleah
159 $ echo z > z
159 $ echo z > z
160 $ hg ci -A -m z z
160 $ hg ci -A -m z z
161 created new head
161 created new head
162
162
163 test pushkeys and bookmarks
163 test pushkeys and bookmarks
164
164
165 $ cd ../local
165 $ cd ../local
166 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote namespaces
166 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote namespaces
167 bookmarks
167 bookmarks
168 namespaces
168 namespaces
169 $ hg book foo -r 0
169 $ hg book foo -r 0
170 $ hg out -B
170 $ hg out -B
171 comparing with ssh://user@dummy/remote
171 comparing with ssh://user@dummy/remote
172 searching for changed bookmarks
172 searching for changed bookmarks
173 foo 1160648e36ce
173 foo 1160648e36ce
174 $ hg push -B foo
174 $ hg push -B foo
175 pushing to ssh://user@dummy/remote
175 pushing to ssh://user@dummy/remote
176 searching for changes
176 searching for changes
177 no changes found
177 no changes found
178 exporting bookmark foo
178 exporting bookmark foo
179 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote bookmarks
179 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote bookmarks
180 foo 1160648e36cec0054048a7edc4110c6f84fde594
180 foo 1160648e36cec0054048a7edc4110c6f84fde594
181 $ hg book -f foo
181 $ hg book -f foo
182 $ hg push --traceback
182 $ hg push --traceback
183 pushing to ssh://user@dummy/remote
183 pushing to ssh://user@dummy/remote
184 searching for changes
184 searching for changes
185 no changes found
185 no changes found
186 updating bookmark foo
186 updating bookmark foo
187 $ hg book -d foo
187 $ hg book -d foo
188 $ hg in -B
188 $ hg in -B
189 comparing with ssh://user@dummy/remote
189 comparing with ssh://user@dummy/remote
190 searching for changed bookmarks
190 searching for changed bookmarks
191 foo a28a9d1a809c
191 foo a28a9d1a809c
192 $ hg book -f -r 0 foo
192 $ hg book -f -r 0 foo
193 $ hg pull -B foo
193 $ hg pull -B foo
194 pulling from ssh://user@dummy/remote
194 pulling from ssh://user@dummy/remote
195 no changes found
195 no changes found
196 updating bookmark foo
196 updating bookmark foo
197 importing bookmark foo
197 importing bookmark foo
198 $ hg book -d foo
198 $ hg book -d foo
199 $ hg push -B foo
199 $ hg push -B foo
200 pushing to ssh://user@dummy/remote
200 pushing to ssh://user@dummy/remote
201 searching for changes
201 searching for changes
202 no changes found
202 no changes found
203 deleting remote bookmark foo
203 deleting remote bookmark foo
204
204
205 a bad, evil hook that prints to stdout
205 a bad, evil hook that prints to stdout
206
206
207 $ cat <<EOF > $TESTTMP/badhook
207 $ cat <<EOF > $TESTTMP/badhook
208 > import sys
208 > import sys
209 > sys.stdout.write("KABOOM\n")
209 > sys.stdout.write("KABOOM\n")
210 > EOF
210 > EOF
211
211
212 $ echo '[hooks]' >> ../remote/.hg/hgrc
212 $ echo '[hooks]' >> ../remote/.hg/hgrc
213 $ echo "changegroup.stdout = python $TESTTMP/badhook" >> ../remote/.hg/hgrc
213 $ echo "changegroup.stdout = python $TESTTMP/badhook" >> ../remote/.hg/hgrc
214 $ echo r > r
214 $ echo r > r
215 $ hg ci -A -m z r
215 $ hg ci -A -m z r
216
216
217 push should succeed even though it has an unexpected response
217 push should succeed even though it has an unexpected response
218
218
219 $ hg push
219 $ hg push
220 pushing to ssh://user@dummy/remote
220 pushing to ssh://user@dummy/remote
221 searching for changes
221 searching for changes
222 note: unsynced remote changes!
222 note: unsynced remote changes!
223 remote: adding changesets
223 remote: adding changesets
224 remote: adding manifests
224 remote: adding manifests
225 remote: adding file changes
225 remote: adding file changes
226 remote: added 1 changesets with 1 changes to 1 files
226 remote: added 1 changesets with 1 changes to 1 files
227 remote: KABOOM
227 remote: KABOOM
228 $ hg -R ../remote heads
228 $ hg -R ../remote heads
229 changeset: 3:1383141674ec
229 changeset: 3:1383141674ec
230 tag: tip
230 tag: tip
231 parent: 1:a28a9d1a809c
231 parent: 1:a28a9d1a809c
232 user: test
232 user: test
233 date: Thu Jan 01 00:00:00 1970 +0000
233 date: Thu Jan 01 00:00:00 1970 +0000
234 summary: z
234 summary: z
235
235
236 changeset: 2:6c0482d977a3
236 changeset: 2:6c0482d977a3
237 parent: 0:1160648e36ce
237 parent: 0:1160648e36ce
238 user: test
238 user: test
239 date: Thu Jan 01 00:00:00 1970 +0000
239 date: Thu Jan 01 00:00:00 1970 +0000
240 summary: z
240 summary: z
241
241
242
242
243 clone bookmarks
243 clone bookmarks
244
244
245 $ hg -R ../remote bookmark test
245 $ hg -R ../remote bookmark test
246 $ hg -R ../remote bookmarks
246 $ hg -R ../remote bookmarks
247 * test 2:6c0482d977a3
247 * test 2:6c0482d977a3
248 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote local-bookmarks
248 $ hg clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/remote local-bookmarks
249 requesting all changes
249 requesting all changes
250 adding changesets
250 adding changesets
251 adding manifests
251 adding manifests
252 adding file changes
252 adding file changes
253 added 4 changesets with 5 changes to 4 files (+1 heads)
253 added 4 changesets with 5 changes to 4 files (+1 heads)
254 updating to branch default
254 updating to branch default
255 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 $ hg -R local-bookmarks bookmarks
256 $ hg -R local-bookmarks bookmarks
257 test 2:6c0482d977a3
257 test 2:6c0482d977a3
258
258
259 passwords in ssh urls are not supported
259 passwords in ssh urls are not supported
260 (we use a glob here because different Python versions give different
260 (we use a glob here because different Python versions give different
261 results here)
261 results here)
262
262
263 $ hg push ssh://user:erroneouspwd@dummy/remote
263 $ hg push ssh://user:erroneouspwd@dummy/remote
264 pushing to ssh://user:*@dummy/remote (glob)
264 pushing to ssh://user:*@dummy/remote (glob)
265 abort: password in URL not supported!
265 abort: password in URL not supported!
266 [255]
266 [255]
267
267
268 $ cd ..
268 $ cd ..
269
269
270 Test remote paths with spaces (issue2983):
270 Test remote paths with spaces (issue2983):
271
271
272 $ hg init --ssh "python $TESTDIR/dummyssh" "ssh://user@dummy/a repo"
272 $ hg init --ssh "python $TESTDIR/dummyssh" "ssh://user@dummy/a repo"
273 $ hg -R 'a repo' tag tag
273 $ hg -R 'a repo' tag tag
274 $ hg id --ssh "python $TESTDIR/dummyssh" "ssh://user@dummy/a repo"
274 $ hg id --ssh "python $TESTDIR/dummyssh" "ssh://user@dummy/a repo"
275 3fb238f49e8c
275 3fb238f49e8c
276
276
277 $ cat dummylog
277 $ cat dummylog
278 Got arguments 1:user@dummy 2:'hg' -R 'nonexistent' serve --stdio
278 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
279 Got arguments 1:user@dummy 2:'hg' -R '/$TESTTMP/nonexistent' serve --stdio
279 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
280 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
280 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
281 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
281 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
282 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
282 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
283 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
283 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
284 Got arguments 1:user@dummy 2:'hg' -R 'local' serve --stdio
284 Got arguments 1:user@dummy 2:hg -R local serve --stdio
285 Got arguments 1:user@dummy 2:'hg' -R '$TESTTMP/local' serve --stdio
285 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
286 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
286 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
287 changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
287 changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
288 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
288 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
289 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
289 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
290 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
291 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
292 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
292 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
293 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
293 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
294 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
294 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
295 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
295 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
296 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
296 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
297 changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
297 changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
298 Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio
298 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
299 Got arguments 1:user@dummy 2:'hg' init 'a repo'
299 Got arguments 1:user@dummy 2:hg init 'a repo'
300 Got arguments 1:user@dummy 2:'hg' -R 'a repo' serve --stdio
300 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
301 Got arguments 1:user@dummy 2:'hg' -R 'a repo' serve --stdio
301 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
@@ -1,105 +1,105 b''
1 $ "$TESTDIR/hghave" serve || exit 80
1 $ "$TESTDIR/hghave" serve || exit 80
2
2
3 Preparing the subrepository 'sub'
3 Preparing the subrepository 'sub'
4
4
5 $ hg init sub
5 $ hg init sub
6 $ echo sub > sub/sub
6 $ echo sub > sub/sub
7 $ hg add -R sub
7 $ hg add -R sub
8 adding sub/sub (glob)
8 adding sub/sub (glob)
9 $ hg commit -R sub -m "sub import"
9 $ hg commit -R sub -m "sub import"
10
10
11 Preparing the 'main' repo which depends on the subrepo 'sub'
11 Preparing the 'main' repo which depends on the subrepo 'sub'
12
12
13 $ hg init main
13 $ hg init main
14 $ echo main > main/main
14 $ echo main > main/main
15 $ echo "sub = ../sub" > main/.hgsub
15 $ echo "sub = ../sub" > main/.hgsub
16 $ hg clone sub main/sub
16 $ hg clone sub main/sub
17 updating to branch default
17 updating to branch default
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 $ hg add -R main
19 $ hg add -R main
20 adding main/.hgsub (glob)
20 adding main/.hgsub (glob)
21 adding main/main (glob)
21 adding main/main (glob)
22 $ hg commit -R main -m "main import"
22 $ hg commit -R main -m "main import"
23 committing subrepository sub
23 committing subrepository sub
24
24
25 Cleaning both repositories, just as a clone -U
25 Cleaning both repositories, just as a clone -U
26
26
27 $ hg up -C -R sub null
27 $ hg up -C -R sub null
28 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
28 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
29 $ hg up -C -R main null
29 $ hg up -C -R main null
30 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
30 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
31 $ rm -rf main/sub
31 $ rm -rf main/sub
32
32
33 Serving them both using hgweb
33 Serving them both using hgweb
34
34
35 $ printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf
35 $ printf '[paths]\n/main = main\nsub = sub\n' > webdir.conf
36 $ hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \
36 $ hg serve --webdir-conf webdir.conf -a localhost -p $HGPORT \
37 > -A /dev/null -E /dev/null --pid-file hg.pid -d
37 > -A /dev/null -E /dev/null --pid-file hg.pid -d
38 $ cat hg.pid >> $DAEMON_PIDS
38 $ cat hg.pid >> $DAEMON_PIDS
39
39
40 Clone main from hgweb
40 Clone main from hgweb
41
41
42 $ hg clone "http://localhost:$HGPORT/main" cloned
42 $ hg clone "http://localhost:$HGPORT/main" cloned
43 requesting all changes
43 requesting all changes
44 adding changesets
44 adding changesets
45 adding manifests
45 adding manifests
46 adding file changes
46 adding file changes
47 added 1 changesets with 3 changes to 3 files
47 added 1 changesets with 3 changes to 3 files
48 updating to branch default
48 updating to branch default
49 cloning subrepo sub from http://localhost:$HGPORT/sub
49 cloning subrepo sub from http://localhost:$HGPORT/sub
50 requesting all changes
50 requesting all changes
51 adding changesets
51 adding changesets
52 adding manifests
52 adding manifests
53 adding file changes
53 adding file changes
54 added 1 changesets with 1 changes to 1 files
54 added 1 changesets with 1 changes to 1 files
55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
56
56
57 Checking cloned repo ids
57 Checking cloned repo ids
58
58
59 $ hg id -R cloned
59 $ hg id -R cloned
60 fdfeeb3e979e tip
60 fdfeeb3e979e tip
61 $ hg id -R cloned/sub
61 $ hg id -R cloned/sub
62 863c1745b441 tip
62 863c1745b441 tip
63
63
64 subrepo debug for 'main' clone
64 subrepo debug for 'main' clone
65
65
66 $ hg debugsub -R cloned
66 $ hg debugsub -R cloned
67 path sub
67 path sub
68 source ../sub
68 source ../sub
69 revision 863c1745b441bd97a8c4a096e87793073f4fb215
69 revision 863c1745b441bd97a8c4a096e87793073f4fb215
70
70
71 $ "$TESTDIR/killdaemons.py"
71 $ "$TESTDIR/killdaemons.py"
72
72
73 subrepo paths with ssh urls
73 subrepo paths with ssh urls
74
74
75 $ cp $TESTDIR/dummyssh $BINDIR/ssh
75 $ cp $TESTDIR/dummyssh $BINDIR/ssh
76
76
77 $ hg clone ssh://user@dummy/cloned sshclone
77 $ hg clone ssh://user@dummy/cloned sshclone
78 requesting all changes
78 requesting all changes
79 adding changesets
79 adding changesets
80 adding manifests
80 adding manifests
81 adding file changes
81 adding file changes
82 added 1 changesets with 3 changes to 3 files
82 added 1 changesets with 3 changes to 3 files
83 updating to branch default
83 updating to branch default
84 cloning subrepo sub from ssh://user@dummy/sub
84 cloning subrepo sub from ssh://user@dummy/sub
85 requesting all changes
85 requesting all changes
86 adding changesets
86 adding changesets
87 adding manifests
87 adding manifests
88 adding file changes
88 adding file changes
89 added 1 changesets with 1 changes to 1 files
89 added 1 changesets with 1 changes to 1 files
90 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
91
91
92 $ hg -R sshclone push ssh://user@dummy/$TESTTMP/cloned
92 $ hg -R sshclone push ssh://user@dummy/$TESTTMP/cloned
93 pushing to ssh://user@dummy/$TESTTMP/cloned
93 pushing to ssh://user@dummy/$TESTTMP/cloned
94 pushing subrepo sub to ssh://user@dummy/$TESTTMP/sub
94 pushing subrepo sub to ssh://user@dummy/$TESTTMP/sub
95 searching for changes
95 searching for changes
96 no changes found
96 no changes found
97 searching for changes
97 searching for changes
98 no changes found
98 no changes found
99
99
100 $ cat dummylog
100 $ cat dummylog
101 Got arguments 1:user@dummy 2:'hg' -R 'cloned' serve --stdio
101 Got arguments 1:user@dummy 2:hg -R cloned serve --stdio
102 Got arguments 1:user@dummy 2:'hg' -R 'sub' serve --stdio
102 Got arguments 1:user@dummy 2:hg -R sub serve --stdio
103 Got arguments 1:user@dummy 2:'hg' -R '$TESTTMP/cloned' serve --stdio
103 Got arguments 1:user@dummy 2:hg -R $TESTTMP/cloned serve --stdio
104 Got arguments 1:user@dummy 2:'hg' -R '$TESTTMP/sub' serve --stdio
104 Got arguments 1:user@dummy 2:hg -R $TESTTMP/sub serve --stdio
105 $ rm $BINDIR/ssh
105 $ rm $BINDIR/ssh
General Comments 0
You need to be logged in to leave comments. Login now