Show More
@@ -18,7 +18,7 b' class sshrepository(remoterepository):' | |||||
18 |
|
18 | |||
19 | m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path) |
|
19 | m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path) | |
20 | if not m: |
|
20 | if not m: | |
21 |
self.r |
|
21 | self.raise_(hg.RepoError(_("couldn't parse location %s") % path)) | |
22 |
|
22 | |||
23 | self.user = m.group(2) |
|
23 | self.user = m.group(2) | |
24 | self.host = m.group(3) |
|
24 | self.host = m.group(3) | |
@@ -38,7 +38,7 b' class sshrepository(remoterepository):' | |||||
38 | ui.note('running %s\n' % cmd) |
|
38 | ui.note('running %s\n' % cmd) | |
39 | res = os.system(cmd) |
|
39 | res = os.system(cmd) | |
40 | if res != 0: |
|
40 | if res != 0: | |
41 |
self.r |
|
41 | self.raise_(hg.RepoError(_("could not create remote repo"))) | |
42 |
|
42 | |||
43 | self.validate_repo(ui, sshcmd, args, remotecmd) |
|
43 | self.validate_repo(ui, sshcmd, args, remotecmd) | |
44 |
|
44 | |||
@@ -70,7 +70,7 b' class sshrepository(remoterepository):' | |||||
70 | lines.append(l) |
|
70 | lines.append(l) | |
71 | max_noise -= 1 |
|
71 | max_noise -= 1 | |
72 | else: |
|
72 | else: | |
73 |
self.r |
|
73 | self.raise_(hg.RepoError(_("no suitable response from remote hg"))) | |
74 |
|
74 | |||
75 | self.capabilities = () |
|
75 | self.capabilities = () | |
76 | lines.reverse() |
|
76 | lines.reverse() | |
@@ -87,9 +87,9 b' class sshrepository(remoterepository):' | |||||
87 | if not l: break |
|
87 | if not l: break | |
88 | self.ui.status(_("remote: "), l) |
|
88 | self.ui.status(_("remote: "), l) | |
89 |
|
89 | |||
90 |
def r |
|
90 | def raise_(self, exception): | |
91 | self.cleanup() |
|
91 | self.cleanup() | |
92 |
raise |
|
92 | raise exception | |
93 |
|
93 | |||
94 | def cleanup(self): |
|
94 | def cleanup(self): | |
95 | try: |
|
95 | try: | |
@@ -121,7 +121,7 b' class sshrepository(remoterepository):' | |||||
121 | try: |
|
121 | try: | |
122 | l = int(l) |
|
122 | l = int(l) | |
123 | except: |
|
123 | except: | |
124 |
self.r |
|
124 | self.raise_(hg.RepoError(_("unexpected response '%s'") % l)) | |
125 | return r.read(l) |
|
125 | return r.read(l) | |
126 |
|
126 | |||
127 | def lock(self): |
|
127 | def lock(self): | |
@@ -137,14 +137,14 b' class sshrepository(remoterepository):' | |||||
137 | if int(success): |
|
137 | if int(success): | |
138 | return bin(data) |
|
138 | return bin(data) | |
139 | else: |
|
139 | else: | |
140 |
self.r |
|
140 | self.raise_(hg.RepoError(data)) | |
141 |
|
141 | |||
142 | def heads(self): |
|
142 | def heads(self): | |
143 | d = self.call("heads") |
|
143 | d = self.call("heads") | |
144 | try: |
|
144 | try: | |
145 | return map(bin, d[:-1].split(" ")) |
|
145 | return map(bin, d[:-1].split(" ")) | |
146 | except: |
|
146 | except: | |
147 |
self.r |
|
147 | self.raise_(hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))) | |
148 |
|
148 | |||
149 | def branches(self, nodes): |
|
149 | def branches(self, nodes): | |
150 | n = " ".join(map(hex, nodes)) |
|
150 | n = " ".join(map(hex, nodes)) | |
@@ -153,7 +153,7 b' class sshrepository(remoterepository):' | |||||
153 | br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] |
|
153 | br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] | |
154 | return br |
|
154 | return br | |
155 | except: |
|
155 | except: | |
156 |
self.r |
|
156 | self.raise_(hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))) | |
157 |
|
157 | |||
158 | def between(self, pairs): |
|
158 | def between(self, pairs): | |
159 | n = "\n".join(["-".join(map(hex, p)) for p in pairs]) |
|
159 | n = "\n".join(["-".join(map(hex, p)) for p in pairs]) | |
@@ -162,7 +162,7 b' class sshrepository(remoterepository):' | |||||
162 | p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ] |
|
162 | p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ] | |
163 | return p |
|
163 | return p | |
164 | except: |
|
164 | except: | |
165 |
self.r |
|
165 | self.raise_(hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))) | |
166 |
|
166 | |||
167 | def changegroup(self, nodes, kind): |
|
167 | def changegroup(self, nodes, kind): | |
168 | n = " ".join(map(hex, nodes)) |
|
168 | n = " ".join(map(hex, nodes)) | |
@@ -176,7 +176,7 b' class sshrepository(remoterepository):' | |||||
176 | def unbundle(self, cg, heads, source): |
|
176 | def unbundle(self, cg, heads, source): | |
177 | d = self.call("unbundle", heads=' '.join(map(hex, heads))) |
|
177 | d = self.call("unbundle", heads=' '.join(map(hex, heads))) | |
178 | if d: |
|
178 | if d: | |
179 |
self.r |
|
179 | self.raise_(hg.RepoError(_("push refused: %s") % d)) | |
180 |
|
180 | |||
181 | while 1: |
|
181 | while 1: | |
182 | d = cg.read(4096) |
|
182 | d = cg.read(4096) | |
@@ -202,7 +202,7 b' class sshrepository(remoterepository):' | |||||
202 | def addchangegroup(self, cg, source, url): |
|
202 | def addchangegroup(self, cg, source, url): | |
203 | d = self.call("addchangegroup") |
|
203 | d = self.call("addchangegroup") | |
204 | if d: |
|
204 | if d: | |
205 |
self.r |
|
205 | self.raise_(hg.RepoError(_("push refused: %s") % d)) | |
206 | while 1: |
|
206 | while 1: | |
207 | d = cg.read(4096) |
|
207 | d = cg.read(4096) | |
208 | if not d: break |
|
208 | if not d: break |
General Comments 0
You need to be logged in to leave comments.
Login now