Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| @wireprotocommand('lookup', 'key') | @wireprotocommand('lookup', 'key') | ||||
| def lookup(repo, proto, key): | def lookup(repo, proto, key): | ||||
| try: | try: | ||||
| k = encoding.tolocal(key) | k = encoding.tolocal(key) | ||||
| c = repo[k] | c = repo[k] | ||||
| r = c.hex() | r = c.hex() | ||||
| success = 1 | success = 1 | ||||
| except Exception as inst: | except Exception as inst: | ||||
| r = str(inst) | r = util.forcebytestr(inst) | ||||
| success = 0 | success = 0 | ||||
| return bytesresponse('%d %s\n' % (success, r)) | return bytesresponse('%d %s\n' % (success, r)) | ||||
| @wireprotocommand('known', 'nodes *') | @wireprotocommand('known', 'nodes *') | ||||
| def known(repo, proto, nodes, others): | def known(repo, proto, nodes, others): | ||||
| v = ''.join(b and '1' or '0' for b in repo.known(decodelist(nodes))) | v = ''.join(b and '1' or '0' for b in repo.known(decodelist(nodes))) | ||||
| return bytesresponse(v) | return bytesresponse(v) | ||||
| part.addparam('ret', exc.ret, mandatory=False) | part.addparam('ret', exc.ret, mandatory=False) | ||||
| except error.BundleValueError as exc: | except error.BundleValueError as exc: | ||||
| errpart = bundler.newpart('error:unsupportedcontent') | errpart = bundler.newpart('error:unsupportedcontent') | ||||
| if exc.parttype is not None: | if exc.parttype is not None: | ||||
| errpart.addparam('parttype', exc.parttype) | errpart.addparam('parttype', exc.parttype) | ||||
| if exc.params: | if exc.params: | ||||
| errpart.addparam('params', '\0'.join(exc.params)) | errpart.addparam('params', '\0'.join(exc.params)) | ||||
| except error.Abort as exc: | except error.Abort as exc: | ||||
| manargs = [('message', str(exc))] | manargs = [('message', util.forcebytestr(exc))] | ||||
| advargs = [] | advargs = [] | ||||
| if exc.hint is not None: | if exc.hint is not None: | ||||
| advargs.append(('hint', exc.hint)) | advargs.append(('hint', exc.hint)) | ||||
| bundler.addpart(bundle2.bundlepart('error:abort', | bundler.addpart(bundle2.bundlepart('error:abort', | ||||
| manargs, advargs)) | manargs, advargs)) | ||||
| except error.PushRaced as exc: | except error.PushRaced as exc: | ||||
| bundler.newpart('error:pushraced', [('message', str(exc))]) | bundler.newpart('error:pushraced', | ||||
| [('message', util.forcebytestr(exc))]) | |||||
| return streamres_legacy(gen=bundler.getchunks()) | return streamres_legacy(gen=bundler.getchunks()) | ||||