##// END OF EJS Templates
httprepo: add support for passing lookup exception data
Matt Mackall -
r3445:233c733e default
parent child Browse files
Show More
@@ -884,7 +884,13 class hgweb(object):
884 req.write(self.filelog(self.filectx(req)))
884 req.write(self.filelog(self.filectx(req)))
885
885
886 def do_lookup(self, req):
886 def do_lookup(self, req):
887 resp = hex(self.repo.lookup(req.form['key'][0])) + "\n"
887 try:
888 r = hex(self.repo.lookup(req.form['key'][0]))
889 success = 1
890 except Exception,inst:
891 r = str(inst)
892 success = 0
893 resp = "%s %s\n" % (success, r)
888 req.httphdr("application/mercurial-0.1", length=len(resp))
894 req.httphdr("application/mercurial-0.1", length=len(resp))
889 req.write(resp)
895 req.write(resp)
890
896
@@ -262,12 +262,11 class httprepository(remoterepository):
262 fp.close()
262 fp.close()
263
263
264 def lookup(self, key):
264 def lookup(self, key):
265 try:
266 d = self.do_cmd("lookup", key = key).read()
265 d = self.do_cmd("lookup", key = key).read()
267 return bin(d[:-1])
266 success, data = d[:-1].split(' ', 1)
268 except:
267 if int(success):
269 self.ui.warn('Not able to look up revision named "%s"\n' % (key,))
268 return bin(data)
270 raise
269 raise hg.RepoError(data)
271
270
272 def heads(self):
271 def heads(self):
273 d = self.do_read("heads")
272 d = self.do_read("heads")
General Comments 0
You need to be logged in to leave comments. Login now