##// END OF EJS Templates
rust-revlog: using the ad-hoc `NodeTree` in scmutil...
Georges Racinet -
r52145:fd1aa5e1 default
parent child Browse files
Show More
@@ -555,20 +555,23 b' def shortesthexnodeidprefix(repo, node, '
555 nodetree = None
555 nodetree = None
556 if cache is not None:
556 if cache is not None:
557 nodetree = cache.get(b'disambiguationnodetree')
557 nodetree = cache.get(b'disambiguationnodetree')
558 is_invalidated = getattr(nodetree, 'is_invalidated', lambda: False)
559 if is_invalidated():
560 nodetree = None
558 if not nodetree:
561 if not nodetree:
559 if hasattr(parsers, 'nodetree'):
562 if hasattr(parsers, 'nodetree') and isinstance(
560 # The CExt is the only implementation to provide a nodetree
563 cl.index, parsers.index
561 # class so far.
564 ):
562 index = cl.index
565 index = cl.index
563 if hasattr(index, 'get_cindex'):
564 # the rust wrapped need to give access to its internal index
565 index = index.get_cindex()
566 nodetree = parsers.nodetree(index, len(revs))
566 nodetree = parsers.nodetree(index, len(revs))
567 for r in revs:
567 elif getattr(cl.index, 'is_rust', False):
568 nodetree.insert(r)
568 nodetree = rustrevlog.NodeTree(cl.index)
569 if cache is not None:
569
570 cache[b'disambiguationnodetree'] = nodetree
571 if nodetree is not None:
570 if nodetree is not None:
571 for r in revs:
572 nodetree.insert(r)
573 if cache is not None:
574 cache[b'disambiguationnodetree'] = nodetree
572 length = max(nodetree.shortest(node), minlength)
575 length = max(nodetree.shortest(node), minlength)
573 prefix = hexnode[:length]
576 prefix = hexnode[:length]
574 return disambiguate(prefix)
577 return disambiguate(prefix)
General Comments 0
You need to be logged in to leave comments. Login now