Show More
@@ -489,6 +489,21 b' def shortesthexnodeidprefix(repo, node, ' | |||
|
489 | 489 | if not isrev(prefix): |
|
490 | 490 | return prefix |
|
491 | 491 | |
|
492 | revset = repo.ui.config('experimental', 'revisions.disambiguatewithin') | |
|
493 | if revset: | |
|
494 | revs = repo.anyrevs([revset], user=True) | |
|
495 | if cl.rev(node) in revs: | |
|
496 | hexnode = hex(node) | |
|
497 | for length in range(minlength, len(hexnode) + 1): | |
|
498 | matches = [] | |
|
499 | prefix = hexnode[:length] | |
|
500 | for rev in revs: | |
|
501 | otherhexnode = repo[rev].hex() | |
|
502 | if prefix == otherhexnode[:length]: | |
|
503 | matches.append(otherhexnode) | |
|
504 | if len(matches) == 1: | |
|
505 | return disambiguate(prefix) | |
|
506 | ||
|
492 | 507 | try: |
|
493 | 508 | return disambiguate(cl.shortest(node, minlength)) |
|
494 | 509 | except error.LookupError: |
@@ -23,6 +23,12 b'' | |||
|
23 | 23 | > [experimental] |
|
24 | 24 | > revisions.disambiguatewithin=:3 |
|
25 | 25 | > EOF |
|
26 | $ hg l | |
|
27 | 4:7ba5d | |
|
28 | 3:7b | |
|
29 | 2:72 | |
|
30 | 1:9 | |
|
31 | 0:b | |
|
26 | 32 | 9 was unambiguous and still is |
|
27 | 33 | $ hg l -r 9 |
|
28 | 34 | 1:9 |
@@ -32,6 +38,6 b' 7 was ambiguous and still is' | |||
|
32 | 38 | [255] |
|
33 | 39 | 7b is no longer ambiguous |
|
34 | 40 | $ hg l -r 7b |
|
35 |
3:7b |
|
|
41 | 3:7b | |
|
36 | 42 | |
|
37 | 43 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now