Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 38856:a01200b25da6
shortest: use 'x' prefix to disambiguate from revnum if configured
Differential Revision: https://phab.mercurial-scm.org/D4042
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 16 Apr 2018 23:49:38 -0700 |
parents | 7848f284b211 |
children | ad88726d6982 |
comparison
equal
deleted
inserted
replaced
38855:7848f284b211 | 38856:a01200b25da6 |
---|---|
488 # which would be unacceptably slow. so we look for hash collision in | 488 # which would be unacceptably slow. so we look for hash collision in |
489 # unfiltered space, which means some hashes may be slightly longer. | 489 # unfiltered space, which means some hashes may be slightly longer. |
490 | 490 |
491 def disambiguate(prefix): | 491 def disambiguate(prefix): |
492 """Disambiguate against revnums.""" | 492 """Disambiguate against revnums.""" |
493 if repo.ui.configbool('experimental', 'revisions.prefixhexnode'): | |
494 if mayberevnum(repo, prefix): | |
495 return 'x' + prefix | |
496 else: | |
497 return prefix | |
498 | |
493 hexnode = hex(node) | 499 hexnode = hex(node) |
494 for length in range(len(prefix), len(hexnode) + 1): | 500 for length in range(len(prefix), len(hexnode) + 1): |
495 prefix = hexnode[:length] | 501 prefix = hexnode[:length] |
496 if not mayberevnum(repo, prefix): | 502 if not mayberevnum(repo, prefix): |
497 return prefix | 503 return prefix |