Show More
@@ -489,6 +489,21 b' def shortesthexnodeidprefix(repo, node, ' | |||||
489 | if not isrev(prefix): |
|
489 | if not isrev(prefix): | |
490 | return prefix |
|
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 | try: |
|
507 | try: | |
493 | return disambiguate(cl.shortest(node, minlength)) |
|
508 | return disambiguate(cl.shortest(node, minlength)) | |
494 | except error.LookupError: |
|
509 | except error.LookupError: |
@@ -23,6 +23,12 b'' | |||||
23 | > [experimental] |
|
23 | > [experimental] | |
24 | > revisions.disambiguatewithin=:3 |
|
24 | > revisions.disambiguatewithin=:3 | |
25 | > EOF |
|
25 | > EOF | |
|
26 | $ hg l | |||
|
27 | 4:7ba5d | |||
|
28 | 3:7b | |||
|
29 | 2:72 | |||
|
30 | 1:9 | |||
|
31 | 0:b | |||
26 | 9 was unambiguous and still is |
|
32 | 9 was unambiguous and still is | |
27 | $ hg l -r 9 |
|
33 | $ hg l -r 9 | |
28 | 1:9 |
|
34 | 1:9 | |
@@ -32,6 +38,6 b' 7 was ambiguous and still is' | |||||
32 | [255] |
|
38 | [255] | |
33 | 7b is no longer ambiguous |
|
39 | 7b is no longer ambiguous | |
34 | $ hg l -r 7b |
|
40 | $ hg l -r 7b | |
35 |
3:7b |
|
41 | 3:7b | |
36 |
|
42 | |||
37 | $ cd .. |
|
43 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now