Show More
@@ -18,6 +18,10 b' class remotelock(object):' | |||||
18 | if self.repo: |
|
18 | if self.repo: | |
19 | self.release() |
|
19 | self.release() | |
20 |
|
20 | |||
|
21 | def _serverquote(s): | |||
|
22 | '''quote a string for the remote shell ... which we assume is sh''' | |||
|
23 | return "'%s'" % s.replace("'", "'\\''") | |||
|
24 | ||||
21 | class sshrepository(wireproto.wirerepository): |
|
25 | class sshrepository(wireproto.wirerepository): | |
22 | def __init__(self, ui, path, create=False): |
|
26 | def __init__(self, ui, path, create=False): | |
23 | self._url = path |
|
27 | self._url = path | |
@@ -40,9 +44,9 b' class sshrepository(wireproto.wirereposi' | |||||
40 | args = util.sshargs(sshcmd, self.host, self.user, self.port) |
|
44 | args = util.sshargs(sshcmd, self.host, self.user, self.port) | |
41 |
|
45 | |||
42 | if create: |
|
46 | if create: | |
43 |
cmd = '%s %s |
|
47 | cmd = '%s %s %s' % (sshcmd, args, | |
44 | cmd = cmd % (sshcmd, args, remotecmd, self.path) |
|
48 | util.shellquote("%s init %s" % | |
45 |
|
49 | (_serverquote(remotecmd), _serverquote(self.path)))) | ||
46 | ui.note(_('running %s\n') % cmd) |
|
50 | ui.note(_('running %s\n') % cmd) | |
47 | res = util.system(cmd) |
|
51 | res = util.system(cmd) | |
48 | if res != 0: |
|
52 | if res != 0: | |
@@ -57,11 +61,11 b' class sshrepository(wireproto.wirereposi' | |||||
57 | # cleanup up previous run |
|
61 | # cleanup up previous run | |
58 | self.cleanup() |
|
62 | self.cleanup() | |
59 |
|
63 | |||
60 |
cmd = '%s %s |
|
64 | cmd = '%s %s %s' % (sshcmd, args, | |
61 | cmd = cmd % (sshcmd, args, remotecmd, self.path) |
|
65 | util.shellquote("%s -R %s serve --stdio" % | |
62 |
|
66 | (_serverquote(remotecmd), _serverquote(self.path)))) | ||
|
67 | ui.note(_('running %s\n') % cmd) | |||
63 | cmd = util.quotecommand(cmd) |
|
68 | cmd = util.quotecommand(cmd) | |
64 | ui.note(_('running %s\n') % cmd) |
|
|||
65 | self.pipeo, self.pipei, self.pipee = util.popen3(cmd) |
|
69 | self.pipeo, self.pipei, self.pipee = util.popen3(cmd) | |
66 |
|
70 | |||
67 | # skip any noise generated by remote shell |
|
71 | # skip any noise generated by remote shell |
@@ -105,13 +105,13 b' clone to existing repo' | |||||
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 |
@@ -266,25 +266,36 b' results here)' | |||||
266 | [255] |
|
266 | [255] | |
267 |
|
267 | |||
268 | $ cd .. |
|
268 | $ cd .. | |
|
269 | ||||
|
270 | Test remote paths with spaces (issue2983): | |||
|
271 | ||||
|
272 | $ hg init --ssh "python $TESTDIR/dummyssh" "ssh://user@dummy/a repo" | |||
|
273 | $ hg -R 'a repo' tag tag | |||
|
274 | $ hg id --ssh "python $TESTDIR/dummyssh" "ssh://user@dummy/a repo" | |||
|
275 | 3fb238f49e8c | |||
|
276 | ||||
269 | $ cat dummylog |
|
277 | $ cat dummylog | |
270 | Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio |
|
278 | Got arguments 1:user@dummy 2:'hg' -R 'nonexistent' serve --stdio | |
271 | 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 | |
272 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
280 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
273 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
281 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
274 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
282 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
275 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
283 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
276 | Got arguments 1:user@dummy 2:hg -R local serve --stdio |
|
284 | Got arguments 1:user@dummy 2:'hg' -R 'local' serve --stdio | |
277 | 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 | |
278 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
286 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
279 | 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 | |
280 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
288 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
281 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
289 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
282 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
290 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
283 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
291 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
284 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
292 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
285 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
293 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
286 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
294 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
287 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
295 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
288 | Got arguments 1:user@dummy 2:hg -R remote serve --stdio |
|
296 | Got arguments 1:user@dummy 2:'hg' -R 'remote' serve --stdio | |
289 | 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 | |
290 | 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' | |||
|
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 |
@@ -98,8 +98,8 b' subrepo paths with ssh urls' | |||||
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