comparison mercurial/templatefuncs.py @ 37903:66dc9db6ed2c

shortest: make {shortest("fffffffff")} work again {shortest("fffffffff")} should shorten it to the shortest unambiguous prefix for the working directory. It used to do that until I broke it in 7b2955624777 (scmutil: make shortesthexnodeidprefix() take a full binary nodeid, 2018-04-14), when we started returning the full hex nodeid for any working directory prefix shorter than 40 hex digits. This patch fixes it by catching WdirUnsupported specifically. Differential Revision: https://phab.mercurial-scm.org/D3455
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 07 May 2018 09:15:29 -0700
parents 7b2955624777
children da083d9fafab
comparison
equal deleted inserted replaced
37902:92ed344a9e64 37903:66dc9db6ed2c
10 import re 10 import re
11 11
12 from .i18n import _ 12 from .i18n import _
13 from .node import ( 13 from .node import (
14 bin, 14 bin,
15 wdirid,
15 ) 16 )
16 from . import ( 17 from . import (
17 color, 18 color,
18 encoding, 19 encoding,
19 error, 20 error,
599 except TypeError: 600 except TypeError:
600 return hexnode 601 return hexnode
601 else: 602 else:
602 try: 603 try:
603 node = scmutil.resolvehexnodeidprefix(repo, hexnode) 604 node = scmutil.resolvehexnodeidprefix(repo, hexnode)
604 except (error.LookupError, error.WdirUnsupported): 605 except error.WdirUnsupported:
606 node = wdirid
607 except error.LookupError:
605 return hexnode 608 return hexnode
606 if not node: 609 if not node:
607 return hexnode 610 return hexnode
608 return scmutil.shortesthexnodeidprefix(repo, node, minlength) 611 return scmutil.shortesthexnodeidprefix(repo, node, minlength)
609 612