##// END OF EJS Templates
sshrepo: catch passwords in ssh urls...
Adrian Buehlmann -
r13464:da0ddd62 stable
parent child Browse files
Show More
@@ -1,198 +1,200 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 from i18n import _
8 from i18n import _
9 import util, error, wireproto
9 import util, error, wireproto
10 import re
10 import re
11
11
12 class remotelock(object):
12 class remotelock(object):
13 def __init__(self, repo):
13 def __init__(self, repo):
14 self.repo = repo
14 self.repo = repo
15 def release(self):
15 def release(self):
16 self.repo.unlock()
16 self.repo.unlock()
17 self.repo = None
17 self.repo = None
18 def __del__(self):
18 def __del__(self):
19 if self.repo:
19 if self.repo:
20 self.release()
20 self.release()
21
21
22 class sshrepository(wireproto.wirerepository):
22 class sshrepository(wireproto.wirerepository):
23 def __init__(self, ui, path, create=0):
23 def __init__(self, ui, path, create=0):
24 self._url = path
24 self._url = path
25 self.ui = ui
25 self.ui = ui
26
26
27 m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path)
27 m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path)
28 if not m:
28 if not m:
29 self._abort(error.RepoError(_("couldn't parse location %s") % path))
29 self._abort(error.RepoError(_("couldn't parse location %s") % path))
30
30
31 self.user = m.group(2)
31 self.user = m.group(2)
32 if self.user and ':' in self.user:
33 self._abort(error.RepoError(_("password in URL not supported")))
32 self.host = m.group(3)
34 self.host = m.group(3)
33 self.port = m.group(5)
35 self.port = m.group(5)
34 self.path = m.group(7) or "."
36 self.path = m.group(7) or "."
35
37
36 sshcmd = self.ui.config("ui", "ssh", "ssh")
38 sshcmd = self.ui.config("ui", "ssh", "ssh")
37 remotecmd = self.ui.config("ui", "remotecmd", "hg")
39 remotecmd = self.ui.config("ui", "remotecmd", "hg")
38
40
39 args = util.sshargs(sshcmd, self.host, self.user, self.port)
41 args = util.sshargs(sshcmd, self.host, self.user, self.port)
40
42
41 if create:
43 if create:
42 cmd = '%s %s "%s init %s"'
44 cmd = '%s %s "%s init %s"'
43 cmd = cmd % (sshcmd, args, remotecmd, self.path)
45 cmd = cmd % (sshcmd, args, remotecmd, self.path)
44
46
45 ui.note(_('running %s\n') % cmd)
47 ui.note(_('running %s\n') % cmd)
46 res = util.system(cmd)
48 res = util.system(cmd)
47 if res != 0:
49 if res != 0:
48 self._abort(error.RepoError(_("could not create remote repo")))
50 self._abort(error.RepoError(_("could not create remote repo")))
49
51
50 self.validate_repo(ui, sshcmd, args, remotecmd)
52 self.validate_repo(ui, sshcmd, args, remotecmd)
51
53
52 def url(self):
54 def url(self):
53 return self._url
55 return self._url
54
56
55 def validate_repo(self, ui, sshcmd, args, remotecmd):
57 def validate_repo(self, ui, sshcmd, args, remotecmd):
56 # cleanup up previous run
58 # cleanup up previous run
57 self.cleanup()
59 self.cleanup()
58
60
59 cmd = '%s %s "%s -R %s serve --stdio"'
61 cmd = '%s %s "%s -R %s serve --stdio"'
60 cmd = cmd % (sshcmd, args, remotecmd, self.path)
62 cmd = cmd % (sshcmd, args, remotecmd, self.path)
61
63
62 cmd = util.quotecommand(cmd)
64 cmd = util.quotecommand(cmd)
63 ui.note(_('running %s\n') % cmd)
65 ui.note(_('running %s\n') % cmd)
64 self.pipeo, self.pipei, self.pipee = util.popen3(cmd)
66 self.pipeo, self.pipei, self.pipee = util.popen3(cmd)
65
67
66 # skip any noise generated by remote shell
68 # skip any noise generated by remote shell
67 self._callstream("hello")
69 self._callstream("hello")
68 r = self._callstream("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
70 r = self._callstream("between", pairs=("%s-%s" % ("0"*40, "0"*40)))
69 lines = ["", "dummy"]
71 lines = ["", "dummy"]
70 max_noise = 500
72 max_noise = 500
71 while lines[-1] and max_noise:
73 while lines[-1] and max_noise:
72 l = r.readline()
74 l = r.readline()
73 self.readerr()
75 self.readerr()
74 if lines[-1] == "1\n" and l == "\n":
76 if lines[-1] == "1\n" and l == "\n":
75 break
77 break
76 if l:
78 if l:
77 ui.debug("remote: ", l)
79 ui.debug("remote: ", l)
78 lines.append(l)
80 lines.append(l)
79 max_noise -= 1
81 max_noise -= 1
80 else:
82 else:
81 self._abort(error.RepoError(_("no suitable response from remote hg")))
83 self._abort(error.RepoError(_("no suitable response from remote hg")))
82
84
83 self.capabilities = set()
85 self.capabilities = set()
84 for l in reversed(lines):
86 for l in reversed(lines):
85 if l.startswith("capabilities:"):
87 if l.startswith("capabilities:"):
86 self.capabilities.update(l[:-1].split(":")[1].split())
88 self.capabilities.update(l[:-1].split(":")[1].split())
87 break
89 break
88
90
89 def readerr(self):
91 def readerr(self):
90 while 1:
92 while 1:
91 size = util.fstat(self.pipee).st_size
93 size = util.fstat(self.pipee).st_size
92 if size == 0:
94 if size == 0:
93 break
95 break
94 s = self.pipee.read(size)
96 s = self.pipee.read(size)
95 if not s:
97 if not s:
96 break
98 break
97 for l in s.splitlines():
99 for l in s.splitlines():
98 self.ui.status(_("remote: "), l, '\n')
100 self.ui.status(_("remote: "), l, '\n')
99
101
100 def _abort(self, exception):
102 def _abort(self, exception):
101 self.cleanup()
103 self.cleanup()
102 raise exception
104 raise exception
103
105
104 def cleanup(self):
106 def cleanup(self):
105 try:
107 try:
106 self.pipeo.close()
108 self.pipeo.close()
107 self.pipei.close()
109 self.pipei.close()
108 # read the error descriptor until EOF
110 # read the error descriptor until EOF
109 for l in self.pipee:
111 for l in self.pipee:
110 self.ui.status(_("remote: "), l)
112 self.ui.status(_("remote: "), l)
111 self.pipee.close()
113 self.pipee.close()
112 except:
114 except:
113 pass
115 pass
114
116
115 __del__ = cleanup
117 __del__ = cleanup
116
118
117 def _callstream(self, cmd, **args):
119 def _callstream(self, cmd, **args):
118 self.ui.debug("sending %s command\n" % cmd)
120 self.ui.debug("sending %s command\n" % cmd)
119 self.pipeo.write("%s\n" % cmd)
121 self.pipeo.write("%s\n" % cmd)
120 for k, v in sorted(args.iteritems()):
122 for k, v in sorted(args.iteritems()):
121 self.pipeo.write("%s %d\n" % (k, len(v)))
123 self.pipeo.write("%s %d\n" % (k, len(v)))
122 self.pipeo.write(v)
124 self.pipeo.write(v)
123 self.pipeo.flush()
125 self.pipeo.flush()
124
126
125 return self.pipei
127 return self.pipei
126
128
127 def _call(self, cmd, **args):
129 def _call(self, cmd, **args):
128 self._callstream(cmd, **args)
130 self._callstream(cmd, **args)
129 return self._recv()
131 return self._recv()
130
132
131 def _callpush(self, cmd, fp, **args):
133 def _callpush(self, cmd, fp, **args):
132 r = self._call(cmd, **args)
134 r = self._call(cmd, **args)
133 if r:
135 if r:
134 return '', r
136 return '', r
135 while 1:
137 while 1:
136 d = fp.read(4096)
138 d = fp.read(4096)
137 if not d:
139 if not d:
138 break
140 break
139 self._send(d)
141 self._send(d)
140 self._send("", flush=True)
142 self._send("", flush=True)
141 r = self._recv()
143 r = self._recv()
142 if r:
144 if r:
143 return '', r
145 return '', r
144 return self._recv(), ''
146 return self._recv(), ''
145
147
146 def _decompress(self, stream):
148 def _decompress(self, stream):
147 return stream
149 return stream
148
150
149 def _recv(self):
151 def _recv(self):
150 l = self.pipei.readline()
152 l = self.pipei.readline()
151 self.readerr()
153 self.readerr()
152 try:
154 try:
153 l = int(l)
155 l = int(l)
154 except:
156 except:
155 self._abort(error.ResponseError(_("unexpected response:"), l))
157 self._abort(error.ResponseError(_("unexpected response:"), l))
156 return self.pipei.read(l)
158 return self.pipei.read(l)
157
159
158 def _send(self, data, flush=False):
160 def _send(self, data, flush=False):
159 self.pipeo.write("%d\n" % len(data))
161 self.pipeo.write("%d\n" % len(data))
160 if data:
162 if data:
161 self.pipeo.write(data)
163 self.pipeo.write(data)
162 if flush:
164 if flush:
163 self.pipeo.flush()
165 self.pipeo.flush()
164 self.readerr()
166 self.readerr()
165
167
166 def lock(self):
168 def lock(self):
167 self._call("lock")
169 self._call("lock")
168 return remotelock(self)
170 return remotelock(self)
169
171
170 def unlock(self):
172 def unlock(self):
171 self._call("unlock")
173 self._call("unlock")
172
174
173 def addchangegroup(self, cg, source, url):
175 def addchangegroup(self, cg, source, url):
174 '''Send a changegroup to the remote server. Return an integer
176 '''Send a changegroup to the remote server. Return an integer
175 similar to unbundle(). DEPRECATED, since it requires locking the
177 similar to unbundle(). DEPRECATED, since it requires locking the
176 remote.'''
178 remote.'''
177 d = self._call("addchangegroup")
179 d = self._call("addchangegroup")
178 if d:
180 if d:
179 self._abort(error.RepoError(_("push refused: %s") % d))
181 self._abort(error.RepoError(_("push refused: %s") % d))
180 while 1:
182 while 1:
181 d = cg.read(4096)
183 d = cg.read(4096)
182 if not d:
184 if not d:
183 break
185 break
184 self.pipeo.write(d)
186 self.pipeo.write(d)
185 self.readerr()
187 self.readerr()
186
188
187 self.pipeo.flush()
189 self.pipeo.flush()
188
190
189 self.readerr()
191 self.readerr()
190 r = self._recv()
192 r = self._recv()
191 if not r:
193 if not r:
192 return 1
194 return 1
193 try:
195 try:
194 return int(r)
196 return int(r)
195 except:
197 except:
196 self._abort(error.ResponseError(_("unexpected response:"), r))
198 self._abort(error.ResponseError(_("unexpected response:"), r))
197
199
198 instance = sshrepository
200 instance = sshrepository
@@ -1,291 +1,298 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 $ cat <<EOF > dummyssh
5 $ cat <<EOF > dummyssh
6 > import sys
6 > import sys
7 > import os
7 > import os
8 >
8 >
9 > os.chdir(os.path.dirname(sys.argv[0]))
9 > os.chdir(os.path.dirname(sys.argv[0]))
10 > if sys.argv[1] != "user@dummy":
10 > if sys.argv[1] != "user@dummy":
11 > sys.exit(-1)
11 > sys.exit(-1)
12 >
12 >
13 > if not os.path.exists("dummyssh"):
13 > if not os.path.exists("dummyssh"):
14 > sys.exit(-1)
14 > sys.exit(-1)
15 >
15 >
16 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
16 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
17 >
17 >
18 > log = open("dummylog", "ab")
18 > log = open("dummylog", "ab")
19 > log.write("Got arguments")
19 > log.write("Got arguments")
20 > for i, arg in enumerate(sys.argv[1:]):
20 > for i, arg in enumerate(sys.argv[1:]):
21 > log.write(" %d:%s" % (i+1, arg))
21 > log.write(" %d:%s" % (i+1, arg))
22 > log.write("\n")
22 > log.write("\n")
23 > log.close()
23 > log.close()
24 > r = os.system(sys.argv[2])
24 > r = os.system(sys.argv[2])
25 > sys.exit(bool(r))
25 > sys.exit(bool(r))
26 > EOF
26 > EOF
27 $ cat <<EOF > badhook
27 $ cat <<EOF > badhook
28 > import sys
28 > import sys
29 > sys.stdout.write("KABOOM\n")
29 > sys.stdout.write("KABOOM\n")
30 > EOF
30 > EOF
31
31
32 creating 'remote
32 creating 'remote
33
33
34 $ hg init remote
34 $ hg init remote
35 $ cd remote
35 $ cd remote
36 $ echo this > foo
36 $ echo this > foo
37 $ echo this > fooO
37 $ echo this > fooO
38 $ hg ci -A -m "init" foo fooO
38 $ hg ci -A -m "init" foo fooO
39 $ echo <<EOF > .hg/hgrc
39 $ echo <<EOF > .hg/hgrc
40 > [server]
40 > [server]
41 > uncompressed = True
41 > uncompressed = True
42 >
42 >
43 > [extensions]
43 > [extensions]
44 > bookmarks =
44 > bookmarks =
45 >
45 >
46 > [hooks]
46 > [hooks]
47 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
47 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
48 > EOF
48 > EOF
49 $ cd ..
49 $ cd ..
50
50
51 repo not found error
51 repo not found error
52
52
53 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
53 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
54 remote: abort: There is no Mercurial repository here (.hg not found)!
54 remote: abort: There is no Mercurial repository here (.hg not found)!
55 abort: no suitable response from remote hg!
55 abort: no suitable response from remote hg!
56 [255]
56 [255]
57
57
58 non-existent absolute path
58 non-existent absolute path
59
59
60 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
60 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
61 remote: abort: There is no Mercurial repository here (.hg not found)!
61 remote: abort: There is no Mercurial repository here (.hg not found)!
62 abort: no suitable response from remote hg!
62 abort: no suitable response from remote hg!
63 [255]
63 [255]
64
64
65 clone remote via stream
65 clone remote via stream
66
66
67 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
67 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
68 streaming all changes
68 streaming all changes
69 4 files to transfer, 392 bytes of data
69 4 files to transfer, 392 bytes of data
70 transferred 392 bytes in * seconds (*/sec) (glob)
70 transferred 392 bytes in * seconds (*/sec) (glob)
71 updating to branch default
71 updating to branch default
72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 $ cd local-stream
73 $ cd local-stream
74 $ hg verify
74 $ hg verify
75 checking changesets
75 checking changesets
76 checking manifests
76 checking manifests
77 crosschecking files in changesets and manifests
77 crosschecking files in changesets and manifests
78 checking files
78 checking files
79 2 files, 1 changesets, 2 total revisions
79 2 files, 1 changesets, 2 total revisions
80 $ cd ..
80 $ cd ..
81
81
82 clone remote via pull
82 clone remote via pull
83
83
84 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
84 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
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 2 changes to 2 files
89 added 1 changesets with 2 changes to 2 files
90 updating to branch default
90 updating to branch default
91 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
92
92
93 verify
93 verify
94
94
95 $ cd local
95 $ cd local
96 $ hg verify
96 $ hg verify
97 checking changesets
97 checking changesets
98 checking manifests
98 checking manifests
99 crosschecking files in changesets and manifests
99 crosschecking files in changesets and manifests
100 checking files
100 checking files
101 2 files, 1 changesets, 2 total revisions
101 2 files, 1 changesets, 2 total revisions
102 $ echo '[hooks]' >> .hg/hgrc
102 $ echo '[hooks]' >> .hg/hgrc
103 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
103 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
104
104
105 empty default pull
105 empty default pull
106
106
107 $ hg paths
107 $ hg paths
108 default = ssh://user@dummy/remote
108 default = ssh://user@dummy/remote
109 $ hg pull -e "python ../dummyssh"
109 $ hg pull -e "python ../dummyssh"
110 pulling from ssh://user@dummy/remote
110 pulling from ssh://user@dummy/remote
111 searching for changes
111 searching for changes
112 no changes found
112 no changes found
113
113
114 local change
114 local change
115
115
116 $ echo bleah > foo
116 $ echo bleah > foo
117 $ hg ci -m "add"
117 $ hg ci -m "add"
118
118
119 updating rc
119 updating rc
120
120
121 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
121 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
122 $ echo "[ui]" >> .hg/hgrc
122 $ echo "[ui]" >> .hg/hgrc
123 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
123 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
124 $ echo '[extensions]' >> .hg/hgrc
124 $ echo '[extensions]' >> .hg/hgrc
125 $ echo 'bookmarks =' >> .hg/hgrc
125 $ echo 'bookmarks =' >> .hg/hgrc
126
126
127 find outgoing
127 find outgoing
128
128
129 $ hg out ssh://user@dummy/remote
129 $ hg out ssh://user@dummy/remote
130 comparing with ssh://user@dummy/remote
130 comparing with ssh://user@dummy/remote
131 searching for changes
131 searching for changes
132 changeset: 1:a28a9d1a809c
132 changeset: 1:a28a9d1a809c
133 tag: tip
133 tag: tip
134 user: test
134 user: test
135 date: Thu Jan 01 00:00:00 1970 +0000
135 date: Thu Jan 01 00:00:00 1970 +0000
136 summary: add
136 summary: add
137
137
138
138
139 find incoming on the remote side
139 find incoming on the remote side
140
140
141 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
141 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
142 comparing with ssh://user@dummy/local
142 comparing with ssh://user@dummy/local
143 searching for changes
143 searching for changes
144 changeset: 1:a28a9d1a809c
144 changeset: 1:a28a9d1a809c
145 tag: tip
145 tag: tip
146 user: test
146 user: test
147 date: Thu Jan 01 00:00:00 1970 +0000
147 date: Thu Jan 01 00:00:00 1970 +0000
148 summary: add
148 summary: add
149
149
150
150
151 find incoming on the remote side (using absolute path)
151 find incoming on the remote side (using absolute path)
152
152
153 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
153 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
154 comparing with ssh://user@dummy/$TESTTMP/local
154 comparing with ssh://user@dummy/$TESTTMP/local
155 searching for changes
155 searching for changes
156 changeset: 1:a28a9d1a809c
156 changeset: 1:a28a9d1a809c
157 tag: tip
157 tag: tip
158 user: test
158 user: test
159 date: Thu Jan 01 00:00:00 1970 +0000
159 date: Thu Jan 01 00:00:00 1970 +0000
160 summary: add
160 summary: add
161
161
162
162
163 push
163 push
164
164
165 $ hg push
165 $ hg push
166 pushing to ssh://user@dummy/remote
166 pushing to ssh://user@dummy/remote
167 searching for changes
167 searching for changes
168 remote: adding changesets
168 remote: adding changesets
169 remote: adding manifests
169 remote: adding manifests
170 remote: adding file changes
170 remote: adding file changes
171 remote: added 1 changesets with 1 changes to 1 files
171 remote: added 1 changesets with 1 changes to 1 files
172 $ cd ../remote
172 $ cd ../remote
173
173
174 check remote tip
174 check remote tip
175
175
176 $ hg tip
176 $ hg tip
177 changeset: 1:a28a9d1a809c
177 changeset: 1:a28a9d1a809c
178 tag: tip
178 tag: tip
179 user: test
179 user: test
180 date: Thu Jan 01 00:00:00 1970 +0000
180 date: Thu Jan 01 00:00:00 1970 +0000
181 summary: add
181 summary: add
182
182
183 $ hg verify
183 $ hg verify
184 checking changesets
184 checking changesets
185 checking manifests
185 checking manifests
186 crosschecking files in changesets and manifests
186 crosschecking files in changesets and manifests
187 checking files
187 checking files
188 2 files, 2 changesets, 3 total revisions
188 2 files, 2 changesets, 3 total revisions
189 $ hg cat -r tip foo
189 $ hg cat -r tip foo
190 bleah
190 bleah
191 $ echo z > z
191 $ echo z > z
192 $ hg ci -A -m z z
192 $ hg ci -A -m z z
193 created new head
193 created new head
194
194
195 test pushkeys and bookmarks
195 test pushkeys and bookmarks
196
196
197 $ cd ../local
197 $ cd ../local
198 $ echo '[extensions]' >> ../remote/.hg/hgrc
198 $ echo '[extensions]' >> ../remote/.hg/hgrc
199 $ echo 'bookmarks =' >> ../remote/.hg/hgrc
199 $ echo 'bookmarks =' >> ../remote/.hg/hgrc
200 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
200 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
201 bookmarks
201 bookmarks
202 namespaces
202 namespaces
203 $ hg book foo -r 0
203 $ hg book foo -r 0
204 $ hg out -B
204 $ hg out -B
205 comparing with ssh://user@dummy/remote
205 comparing with ssh://user@dummy/remote
206 searching for changed bookmarks
206 searching for changed bookmarks
207 foo 1160648e36ce
207 foo 1160648e36ce
208 $ hg push -B foo
208 $ hg push -B foo
209 pushing to ssh://user@dummy/remote
209 pushing to ssh://user@dummy/remote
210 searching for changes
210 searching for changes
211 no changes found
211 no changes found
212 exporting bookmark foo
212 exporting bookmark foo
213 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
213 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
214 foo 1160648e36cec0054048a7edc4110c6f84fde594
214 foo 1160648e36cec0054048a7edc4110c6f84fde594
215 $ hg book -f foo
215 $ hg book -f foo
216 $ hg push --traceback
216 $ hg push --traceback
217 pushing to ssh://user@dummy/remote
217 pushing to ssh://user@dummy/remote
218 searching for changes
218 searching for changes
219 no changes found
219 no changes found
220 updating bookmark foo
220 updating bookmark foo
221 $ hg book -d foo
221 $ hg book -d foo
222 $ hg in -B
222 $ hg in -B
223 comparing with ssh://user@dummy/remote
223 comparing with ssh://user@dummy/remote
224 searching for changed bookmarks
224 searching for changed bookmarks
225 foo a28a9d1a809c
225 foo a28a9d1a809c
226 $ hg book -f -r 0 foo
226 $ hg book -f -r 0 foo
227 $ hg pull -B foo
227 $ hg pull -B foo
228 pulling from ssh://user@dummy/remote
228 pulling from ssh://user@dummy/remote
229 searching for changes
229 searching for changes
230 no changes found
230 no changes found
231 updating bookmark foo
231 updating bookmark foo
232 importing bookmark foo
232 importing bookmark foo
233 $ hg book -d foo
233 $ hg book -d foo
234 $ hg push -B foo
234 $ hg push -B foo
235 pushing to ssh://user@dummy/remote
235 pushing to ssh://user@dummy/remote
236 searching for changes
236 searching for changes
237 no changes found
237 no changes found
238 deleting remote bookmark foo
238 deleting remote bookmark foo
239
239
240 a bad, evil hook that prints to stdout
240 a bad, evil hook that prints to stdout
241
241
242 $ echo '[hooks]' >> ../remote/.hg/hgrc
242 $ echo '[hooks]' >> ../remote/.hg/hgrc
243 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
243 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
244 $ echo r > r
244 $ echo r > r
245 $ hg ci -A -m z r
245 $ hg ci -A -m z r
246
246
247 push should succeed even though it has an unexpected response
247 push should succeed even though it has an unexpected response
248
248
249 $ hg push
249 $ hg push
250 pushing to ssh://user@dummy/remote
250 pushing to ssh://user@dummy/remote
251 searching for changes
251 searching for changes
252 note: unsynced remote changes!
252 note: unsynced remote changes!
253 remote: adding changesets
253 remote: adding changesets
254 remote: adding manifests
254 remote: adding manifests
255 remote: adding file changes
255 remote: adding file changes
256 remote: added 1 changesets with 1 changes to 1 files
256 remote: added 1 changesets with 1 changes to 1 files
257 remote: KABOOM
257 remote: KABOOM
258 $ hg -R ../remote heads
258 $ hg -R ../remote heads
259 changeset: 3:1383141674ec
259 changeset: 3:1383141674ec
260 tag: tip
260 tag: tip
261 parent: 1:a28a9d1a809c
261 parent: 1:a28a9d1a809c
262 user: test
262 user: test
263 date: Thu Jan 01 00:00:00 1970 +0000
263 date: Thu Jan 01 00:00:00 1970 +0000
264 summary: z
264 summary: z
265
265
266 changeset: 2:6c0482d977a3
266 changeset: 2:6c0482d977a3
267 parent: 0:1160648e36ce
267 parent: 0:1160648e36ce
268 user: test
268 user: test
269 date: Thu Jan 01 00:00:00 1970 +0000
269 date: Thu Jan 01 00:00:00 1970 +0000
270 summary: z
270 summary: z
271
271
272
273 passwords in ssh urls are not supported
274
275 $ hg push ssh://user:erroneouspwd@dummy/remote
276 abort: password in URL not supported!
277 [255]
278
272 $ cd ..
279 $ cd ..
273 $ cat dummylog
280 $ cat dummylog
274 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
281 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
275 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
282 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
276 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
283 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
277 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
284 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
278 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
285 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
279 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
286 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
280 Got arguments 1:user@dummy 2:hg -R local serve --stdio
287 Got arguments 1:user@dummy 2:hg -R local serve --stdio
281 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
288 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
282 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
289 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
283 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
284 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
285 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
292 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
286 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
293 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
287 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
294 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
288 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
295 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
289 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
296 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
297 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
298 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now