##// END OF EJS Templates
protocol: convert some ssh abort calls
Matt Mackall -
r11590:0b15aee0 default
parent child Browse files
Show More
@@ -27,7 +27,7 b' class sshrepository(wireproto.wirereposi'
27 27
28 28 m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path)
29 29 if not m:
30 self.abort(error.RepoError(_("couldn't parse location %s") % path))
30 self._abort(error.RepoError(_("couldn't parse location %s") % path))
31 31
32 32 self.user = m.group(2)
33 33 self.host = m.group(3)
@@ -46,7 +46,7 b' class sshrepository(wireproto.wirereposi'
46 46 ui.note(_('running %s\n') % cmd)
47 47 res = util.system(cmd)
48 48 if res != 0:
49 self.abort(error.RepoError(_("could not create remote repo")))
49 self._abort(error.RepoError(_("could not create remote repo")))
50 50
51 51 self.validate_repo(ui, sshcmd, args, remotecmd)
52 52
@@ -79,7 +79,7 b' class sshrepository(wireproto.wirereposi'
79 79 lines.append(l)
80 80 max_noise -= 1
81 81 else:
82 self.abort(error.RepoError(_("no suitable response from remote hg")))
82 self._abort(error.RepoError(_("no suitable response from remote hg")))
83 83
84 84 self.capabilities = set()
85 85 for l in reversed(lines):
@@ -97,10 +97,6 b' class sshrepository(wireproto.wirereposi'
97 97 break
98 98 self.ui.status(_("remote: "), l)
99 99
100 def abort(self, exception):
101 self.cleanup()
102 raise exception
103
104 100 def _abort(self, exception):
105 101 self.cleanup()
106 102 raise exception
@@ -138,7 +134,7 b' class sshrepository(wireproto.wirereposi'
138 134 try:
139 135 l = int(l)
140 136 except:
141 self.abort(error.ResponseError(_("unexpected response:"), l))
137 self._abort(error.ResponseError(_("unexpected response:"), l))
142 138 return self.pipei.read(l)
143 139
144 140 def _send(self, data, flush=False):
@@ -174,7 +170,7 b' class sshrepository(wireproto.wirereposi'
174 170 d = self._call("unbundle", heads=' '.join(map(hex, heads)))
175 171 if d:
176 172 # remote may send "unsynced changes"
177 self.abort(error.RepoError(_("push refused: %s") % d))
173 self._abort(error.RepoError(_("push refused: %s") % d))
178 174
179 175 while 1:
180 176 d = cg.read(4096)
@@ -187,13 +183,13 b' class sshrepository(wireproto.wirereposi'
187 183 r = self._recv()
188 184 if r:
189 185 # remote may send "unsynced changes"
190 self.abort(error.RepoError(_("push failed: %s") % r))
186 self._abort(error.RepoError(_("push failed: %s") % r))
191 187
192 188 r = self._recv()
193 189 try:
194 190 return int(r)
195 191 except:
196 self.abort(error.ResponseError(_("unexpected response:"), r))
192 self._abort(error.ResponseError(_("unexpected response:"), r))
197 193
198 194 def addchangegroup(self, cg, source, url):
199 195 '''Send a changegroup to the remote server. Return an integer
@@ -201,7 +197,7 b' class sshrepository(wireproto.wirereposi'
201 197 remote.'''
202 198 d = self._call("addchangegroup")
203 199 if d:
204 self.abort(error.RepoError(_("push refused: %s") % d))
200 self._abort(error.RepoError(_("push refused: %s") % d))
205 201 while 1:
206 202 d = cg.read(4096)
207 203 if not d:
@@ -218,6 +214,6 b' class sshrepository(wireproto.wirereposi'
218 214 try:
219 215 return int(r)
220 216 except:
221 self.abort(error.ResponseError(_("unexpected response:"), r))
217 self._abort(error.ResponseError(_("unexpected response:"), r))
222 218
223 219 instance = sshrepository
General Comments 0
You need to be logged in to leave comments. Login now