Show More
@@ -12,6 +12,7 b' import re' | |||||
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, | |
@@ -601,7 +602,9 b' def shortest(context, mapping, args):' | |||||
601 | else: |
|
602 | else: | |
602 | try: |
|
603 | try: | |
603 | node = scmutil.resolvehexnodeidprefix(repo, hexnode) |
|
604 | node = scmutil.resolvehexnodeidprefix(repo, hexnode) | |
604 |
except |
|
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 |
@@ -3916,6 +3916,15 b' Test shortest(node) function:' | |||||
3916 | $ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1 |
|
3916 | $ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1 | |
3917 | not a hex string, but it's 40 bytes long |
|
3917 | not a hex string, but it's 40 bytes long | |
3918 |
|
3918 | |||
|
3919 | $ hg log --template '{shortest("ffffffffffffffffffffffffffffffffffffffff")}\n' -l1 | |||
|
3920 | ffff | |||
|
3921 | ||||
|
3922 | $ hg log --template '{shortest("fffffff")}\n' -l1 | |||
|
3923 | ffff | |||
|
3924 | ||||
|
3925 | $ hg log --template '{shortest("ff")}\n' -l1 | |||
|
3926 | ffff | |||
|
3927 | ||||
3919 | $ cd .. |
|
3928 | $ cd .. | |
3920 |
|
3929 | |||
3921 | Test shortest(node) with the repo having short hash collision: |
|
3930 | Test shortest(node) with the repo having short hash collision: |
General Comments 0
You need to be logged in to leave comments.
Login now