Mercurial > hg
comparison mercurial/scmutil.py @ 44013:992f0d6e7f33
rust-index: use the new method in shortesthexnodeidprefix
This code can now run with both a Rust or a C index.
Differential Revision: https://phab.mercurial-scm.org/D7659
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Wed, 11 Dec 2019 18:10:20 +0100 |
parents | 60de488cad11 |
children | 0750cbffdb3b |
comparison
equal
deleted
inserted
replaced
44012:443dc1655923 | 44013:992f0d6e7f33 |
---|---|
56 from . import scmwindows as scmplatform | 56 from . import scmwindows as scmplatform |
57 else: | 57 else: |
58 from . import scmposix as scmplatform | 58 from . import scmposix as scmplatform |
59 | 59 |
60 parsers = policy.importmod('parsers') | 60 parsers = policy.importmod('parsers') |
61 rustrevlog = policy.importrust('revlog') | |
61 | 62 |
62 termsize = scmplatform.termsize | 63 termsize = scmplatform.termsize |
63 | 64 |
64 | 65 |
65 @attr.s(slots=True, repr=False) | 66 @attr.s(slots=True, repr=False) |
546 nodetree = cache.get(b'disambiguationnodetree') | 547 nodetree = cache.get(b'disambiguationnodetree') |
547 if not nodetree: | 548 if not nodetree: |
548 if util.safehasattr(parsers, 'nodetree'): | 549 if util.safehasattr(parsers, 'nodetree'): |
549 # The CExt is the only implementation to provide a nodetree | 550 # The CExt is the only implementation to provide a nodetree |
550 # class so far. | 551 # class so far. |
551 nodetree = parsers.nodetree(cl.index, len(revs)) | 552 index = cl.index |
553 if util.safehasattr(index, 'get_cindex'): | |
554 # the rust wrapped need to give access to its internal index | |
555 index = index.get_cindex() | |
556 nodetree = parsers.nodetree(index, len(revs)) | |
552 for r in revs: | 557 for r in revs: |
553 nodetree.insert(r) | 558 nodetree.insert(r) |
554 if cache is not None: | 559 if cache is not None: |
555 cache[b'disambiguationnodetree'] = nodetree | 560 cache[b'disambiguationnodetree'] = nodetree |
556 if nodetree is not None: | 561 if nodetree is not None: |