Mercurial > hg-stable
changeset 3381:bb9852b3bf06
Merge with asak
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 13 Oct 2006 10:50:35 +0200 |
parents | fef022f9a238 (current diff) 8770b4870e22 (diff) |
children | 80721b86a448 |
files | |
diffstat | 2 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/sshrepo.py Fri Oct 13 00:26:46 2006 -0700 +++ b/mercurial/sshrepo.py Fri Oct 13 10:50:35 2006 +0200 @@ -18,7 +18,7 @@ m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path) if not m: - raise hg.RepoError(_("couldn't parse location %s") % path) + self.repoerror(_("couldn't parse location %s") % path) self.user = m.group(2) self.host = m.group(3) @@ -38,7 +38,7 @@ ui.note('running %s\n' % cmd) res = os.system(cmd) if res != 0: - raise hg.RepoError(_("could not create remote repo")) + self.repoerror(_("could not create remote repo")) self.validate_repo(ui, sshcmd, args, remotecmd) @@ -70,7 +70,7 @@ lines.append(l) max_noise -= 1 else: - raise hg.RepoError(_("no suitable response from remote hg")) + self.repoerror(_("no suitable response from remote hg")) self.capabilities = () lines.reverse() @@ -87,6 +87,10 @@ if not l: break self.ui.status(_("remote: "), l) + def repoerror(self, msg): + self.cleanup() + raise hg.RepoError(msg) + def cleanup(self): try: self.pipeo.close() @@ -117,7 +121,7 @@ try: l = int(l) except: - raise hg.RepoError(_("unexpected response '%s'") % l) + self.repoerror(_("unexpected response '%s'") % l) return r.read(l) def lock(self): @@ -132,7 +136,7 @@ try: return map(bin, d[:-1].split(" ")) except: - raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "...")) + self.repoerror(_("unexpected response '%s'") % (d[:400] + "...")) def branches(self, nodes): n = " ".join(map(hex, nodes)) @@ -141,7 +145,7 @@ br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] return br except: - raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "...")) + self.repoerror(_("unexpected response '%s'") % (d[:400] + "...")) def between(self, pairs): n = "\n".join(["-".join(map(hex, p)) for p in pairs]) @@ -150,7 +154,7 @@ p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ] return p except: - raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "...")) + self.repoerror(_("unexpected response '%s'") % (d[:400] + "...")) def changegroup(self, nodes, kind): n = " ".join(map(hex, nodes)) @@ -159,7 +163,7 @@ def unbundle(self, cg, heads, source): d = self.call("unbundle", heads=' '.join(map(hex, heads))) if d: - raise hg.RepoError(_("push refused: %s") % d) + self.repoerror(_("push refused: %s") % d) while 1: d = cg.read(4096) @@ -185,7 +189,7 @@ def addchangegroup(self, cg, source, url): d = self.call("addchangegroup") if d: - raise hg.RepoError(_("push refused: %s") % d) + self.repoerror(_("push refused: %s") % d) while 1: d = cg.read(4096) if not d: break
--- a/tests/test-ssh.out Fri Oct 13 00:26:46 2006 -0700 +++ b/tests/test-ssh.out Fri Oct 13 10:50:35 2006 +0200 @@ -1,7 +1,7 @@ # creating 'remote' # repo not found error +remote: abort: repository nonexistent not found! abort: no suitable response from remote hg! -remote: abort: repository nonexistent not found! # clone remote via stream streaming all changes XXX files to transfer, XXX bytes of data