Show More
@@ -28,7 +28,10 b' The following config options can influen' | |||
|
28 | 28 | from __future__ import absolute_import |
|
29 | 29 | |
|
30 | 30 | from mercurial.i18n import _ |
|
31 |
from mercurial.node import |
|
|
31 | from mercurial.node import ( | |
|
32 | hex, | |
|
33 | nullrev, | |
|
34 | ) | |
|
32 | 35 | from mercurial import ( |
|
33 | 36 | cmdutil, |
|
34 | 37 | commands, |
@@ -440,17 +443,11 b' def longestshortest(repo, revs, minlen=4' | |||
|
440 | 443 | If we fail to do this, a value of e.g. ``10023`` could mean either |
|
441 | 444 | revision 10023 or node ``10023abc...``. |
|
442 | 445 | """ |
|
443 | tres = formatter.templateresources(repo.ui, repo) | |
|
444 | tmpl = formatter.maketemplater(repo.ui, '{shortest(node, %d)}' % minlen, | |
|
445 | resources=tres) | |
|
446 | ||
|
447 | lens = [minlen] | |
|
448 | for rev in revs: | |
|
449 | ctx = repo[rev] | |
|
450 | shortest = tmpl.render({'ctx': ctx, 'node': ctx.hex()}) | |
|
451 | lens.append(len(shortest)) | |
|
452 | ||
|
453 | return max(lens) | |
|
446 | if not revs: | |
|
447 | return minlen | |
|
448 | # don't use filtered repo because it's slow. see templater.shortest(). | |
|
449 | cl = repo.unfiltered().changelog | |
|
450 | return max(len(cl.shortest(hex(cl.node(r)), minlen)) for r in revs) | |
|
454 | 451 | |
|
455 | 452 | # Adjust the docstring of the show command so it shows all registered views. |
|
456 | 453 | # This is a bit hacky because it runs at the end of module load. When moved |
General Comments 0
You need to be logged in to leave comments.
Login now