Comments
Patch
@@ -3916,6 +3916,15 @@
$ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1
not a hex string, but it's 40 bytes long
+ $ hg log --template '{shortest("ffffffffffffffffffffffffffffffffffffffff")}\n' -l1
+ ffff
+
+ $ hg log --template '{shortest("fffffff")}\n' -l1
+ ffff
+
+ $ hg log --template '{shortest("ff")}\n' -l1
+ ffff
+
$ cd ..
Test shortest(node) with the repo having short hash collision:
@@ -12,6 +12,7 @@
from .i18n import _
from .node import (
bin,
+ wdirid,
)
from . import (
color,
@@ -601,7 +602,9 @@
else:
try:
node = scmutil.resolvehexnodeidprefix(repo, hexnode)
- except (error.LookupError, error.WdirUnsupported):
+ except error.WdirUnsupported:
+ node = wdirid
+ except error.LookupError:
return hexnode
if not node:
return hexnode