##// END OF EJS Templates
Mercurial: fixed lookup for hg 4.9
marcink -
r657:377e31e9 default
parent child Browse files
Show More
@@ -20,6 +20,7 b' import logging'
20 20 import stat
21 21 import urllib
22 22 import urllib2
23 import traceback
23 24
24 25 from hgext import largefiles, rebase
25 26 from hgext.strip import strip as hgext_strip
@@ -31,11 +32,11 b' import vcsserver'
31 32 from vcsserver import exceptions
32 33 from vcsserver.base import RepoFactory, obfuscate_qs, raise_from_original
33 34 from vcsserver.hgcompat import (
34 archival, bin, clone, config as hgconfig, diffopts, hex,
35 archival, bin, clone, config as hgconfig, diffopts, hex, revsymbol,
35 36 hg_url as url_parser, httpbasicauthhandler, httpdigestauthhandler,
36 37 makepeer, instance, match, memctx, exchange, memfilectx, nullrev,
37 38 patch, peer, revrange, ui, hg_tag, Abort, LookupError, RepoError,
38 RepoLookupError, InterventionRequired, RequirementError)
39 RepoLookupError, ProgrammingError, InterventionRequired, RequirementError)
39 40
40 41 log = logging.getLogger(__name__)
41 42
@@ -55,6 +56,9 b' def make_ui_from_config(repo_config):'
55 56 baseui.setconfig('ui', 'quiet', 'true')
56 57
57 58 baseui.setconfig('ui', 'paginate', 'never')
59 # for better Error reporting of Mercurial
60 baseui.setconfig('ui', 'message-output', 'stderr')
61
58 62 # force mercurial to only use 1 thread, otherwise it may try to set a
59 63 # signal in a non-main thread, thus generating a ValueError.
60 64 baseui.setconfig('worker', 'numcpus', 1)
@@ -266,15 +270,6 b' class HgRemote(object):'
266 270 ctx = repo[revision]
267 271 return ctx.description()
268 272
269 # @reraise_safe_exceptions
270 # def ctx_diff(
271 # self, wire, revision, git=True, ignore_whitespace=True, context=3):
272 # repo = self._factory.repo(wire)
273 # ctx = repo[revision]
274 # result = ctx.diff(
275 # git=git, ignore_whitespace=ignore_whitespace, context=context)
276 # return list(result)
277
278 273 @reraise_safe_exceptions
279 274 def ctx_files(self, wire, revision):
280 275 repo = self._factory.repo(wire)
@@ -490,8 +485,9 b' class HgRemote(object):'
490 485 @reraise_safe_exceptions
491 486 def get_all_commit_ids(self, wire, name):
492 487 repo = self._factory.repo(wire)
493 revs = repo.filtered(name).changelog.index
494 return map(lambda x: hex(x[7]), revs)[:-1]
488 repo = repo.filtered(name)
489 revs = map(lambda x: hex(x[7]), repo.changelog.index)
490 return revs
495 491
496 492 @reraise_safe_exceptions
497 493 def get_config_value(self, wire, section, name, untrusted=False):
@@ -544,22 +540,24 b' class HgRemote(object):'
544 540
545 541 if isinstance(revision, int):
546 542 # NOTE(marcink):
547 # since Mercurial doesn't support indexes properly
543 # since Mercurial doesn't support negative indexes properly
548 544 # we need to shift accordingly by one to get proper index, e.g
549 545 # repo[-1] => repo[-2]
550 546 # repo[0] => repo[-1]
551 # repo[1] => repo[2] we also never call repo[0] because
552 # it's actually second commit
553 547 if revision <= 0:
554 548 revision = revision + -1
555 else:
556 revision = revision + 1
557
549 try:
558 550 try:
559 551 ctx = repo[revision]
560 except RepoLookupError as e:
552 except ProgrammingError:
553 # we're unable to find the rev using a regular lookup, we fallback
554 # to slower, but backward compat revsymbol usage
555 ctx = revsymbol(repo, revision)
556 except (TypeError, RepoLookupError) as e:
557 e._org_exc_tb = traceback.format_exc()
561 558 raise exceptions.LookupException(e)(revision)
562 559 except LookupError as e:
560 e._org_exc_tb = traceback.format_exc()
563 561 raise exceptions.LookupException(e)(e.name)
564 562
565 563 if not both:
@@ -42,7 +42,7 b' from mercurial.commands import clone, nu'
42 42 from mercurial.context import memctx, memfilectx
43 43 from mercurial.error import (
44 44 LookupError, RepoError, RepoLookupError, Abort, InterventionRequired,
45 RequirementError)
45 RequirementError, ProgrammingError)
46 46 from mercurial.hgweb import hgweb_mod
47 47 from mercurial.localrepo import instance
48 48 from mercurial.match import match
@@ -53,7 +53,7 b' from mercurial.discovery import findcomm'
53 53 from mercurial.hg import peer
54 54 from mercurial.httppeer import makepeer
55 55 from mercurial.util import url as hg_url
56 from mercurial.scmutil import revrange
56 from mercurial.scmutil import revrange, revsymbol
57 57 from mercurial.node import nullrev
58 58 from mercurial import exchange
59 59 from hgext import largefiles
General Comments 0
You need to be logged in to leave comments. Login now