Mercurial > public > mercurial-scm > hg
comparison mercurial/templatefuncs.py @ 37708:8e8541610d85
scmutil: make shortesthexnodeidprefix() use unfiltered repo
Both callers were doing this, and resolvehexnodeidprefix() was also
working on the unfiltered repo, so it makes more sense to have it all
in one place.
Differential Revision: https://phab.mercurial-scm.org/D3313
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 13 Apr 2018 10:36:03 -0700 |
parents | e743b8524d60 |
children | 7b2955624777 |
comparison
equal
deleted
inserted
replaced
37707:24fee31fda05 | 37708:8e8541610d85 |
---|---|
585 if len(args) > 1: | 585 if len(args) > 1: |
586 minlength = evalinteger(context, mapping, args[1], | 586 minlength = evalinteger(context, mapping, args[1], |
587 # i18n: "shortest" is a keyword | 587 # i18n: "shortest" is a keyword |
588 _("shortest() expects an integer minlength")) | 588 _("shortest() expects an integer minlength")) |
589 | 589 |
590 # _partialmatch() of filtered changelog could take O(len(repo)) time, | |
591 # which would be unacceptably slow. so we look for hash collision in | |
592 # unfiltered space, which means some hashes may be slightly longer. | |
593 repo = context.resource(mapping, 'ctx')._repo | 590 repo = context.resource(mapping, 'ctx')._repo |
594 return scmutil.shortesthexnodeidprefix(repo.unfiltered(), node, minlength) | 591 return scmutil.shortesthexnodeidprefix(repo, node, minlength) |
595 | 592 |
596 @templatefunc('strip(text[, chars])') | 593 @templatefunc('strip(text[, chars])') |
597 def strip(context, mapping, args): | 594 def strip(context, mapping, args): |
598 """Strip characters from a string. By default, | 595 """Strip characters from a string. By default, |
599 strips all leading and trailing whitespace.""" | 596 strips all leading and trailing whitespace.""" |