Show More
@@ -447,10 +447,8 b' def longestshortest(repo, revs, minlen=4' | |||
|
447 | 447 | """ |
|
448 | 448 | if not revs: |
|
449 | 449 | return minlen |
|
450 | # don't use filtered repo because it's slow. see templater.shortest(). | |
|
451 | 450 | cl = repo.changelog |
|
452 |
return max(len(scmutil.shortesthexnodeidprefix(repo. |
|
|
453 | hex(cl.node(r)), | |
|
451 | return max(len(scmutil.shortesthexnodeidprefix(repo, hex(cl.node(r)), | |
|
454 | 452 | minlen)) for r in revs) |
|
455 | 453 | |
|
456 | 454 | # Adjust the docstring of the show command so it shows all registered views. |
@@ -436,7 +436,7 b' def formatrevnode(ui, rev, node):' | |||
|
436 | 436 | |
|
437 | 437 | def resolvehexnodeidprefix(repo, prefix): |
|
438 | 438 | # Uses unfiltered repo because it's faster when prefix is ambiguous/ |
|
439 |
# This matches the |
|
|
439 | # This matches the shortesthexnodeidprefix() function below. | |
|
440 | 440 | node = repo.unfiltered().changelog._partialmatch(prefix) |
|
441 | 441 | if node is None: |
|
442 | 442 | return |
@@ -445,7 +445,10 b' def resolvehexnodeidprefix(repo, prefix)' | |||
|
445 | 445 | |
|
446 | 446 | def shortesthexnodeidprefix(repo, hexnode, minlength=1): |
|
447 | 447 | """Find the shortest unambiguous prefix that matches hexnode.""" |
|
448 | return repo.changelog.shortest(hexnode, minlength) | |
|
448 | # _partialmatch() of filtered changelog could take O(len(repo)) time, | |
|
449 | # which would be unacceptably slow. so we look for hash collision in | |
|
450 | # unfiltered space, which means some hashes may be slightly longer. | |
|
451 | return repo.unfiltered().changelog.shortest(hexnode, minlength) | |
|
449 | 452 | |
|
450 | 453 | def isrevsymbol(repo, symbol): |
|
451 | 454 | """Checks if a symbol exists in the repo. |
@@ -587,11 +587,8 b' def shortest(context, mapping, args):' | |||
|
587 | 587 | # i18n: "shortest" is a keyword |
|
588 | 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 | 590 | repo = context.resource(mapping, 'ctx')._repo |
|
594 |
return scmutil.shortesthexnodeidprefix(repo |
|
|
591 | return scmutil.shortesthexnodeidprefix(repo, node, minlength) | |
|
595 | 592 | |
|
596 | 593 | @templatefunc('strip(text[, chars])') |
|
597 | 594 | def strip(context, mapping, args): |
General Comments 0
You need to be logged in to leave comments.
Login now