# HG changeset patch # User Eric Hopper # Date 1157851506 25200 # Node ID ef1032c223e7fd813063460503737a9a3003a0a8 # Parent 0b450267cf472a634ff03362ca7a89b386574f4d sshrepo: add passing of lookup exceptions diff -r 0b450267cf47 -r ef1032c223e7 mercurial/sshrepo.py --- a/mercurial/sshrepo.py Sat Sep 09 18:25:06 2006 -0700 +++ b/mercurial/sshrepo.py Sat Sep 09 18:25:06 2006 -0700 @@ -133,9 +133,14 @@ def lookup(self, key): d = self.call("lookup", key=key) + success, data = d[:-1].split(" ", 1) try: - return bin(d[:-1]) + if int(success): + return bin(data) + else: + raise data except: + raise raise hg.RepoError("unexpected response '%s'" % (d[:400] + "...")) def heads(self): diff -r 0b450267cf47 -r ef1032c223e7 mercurial/sshserver.py --- a/mercurial/sshserver.py Sat Sep 09 18:25:06 2006 -0700 +++ b/mercurial/sshserver.py Sat Sep 09 18:25:06 2006 -0700 @@ -51,7 +51,13 @@ def do_lookup(self): arg, key = self.getarg() assert arg == 'key' - self.respond(hex(self.repo.lookup(key)) + "\n") + try: + r = hex(self.repo.lookup(key)) + success = 1 + except Exception,inst: + r = str(inst) + success = 0 + self.respond("%s %s\n" % (success, r)) def do_heads(self): h = self.repo.heads()