Mercurial > hg-stable
changeset 37911:0a79fb64118e
revset: use resolvehexnodeidprefix() in id() predicate (BC)
We now have a public method for this purpose, so we don't need to
access the private revlog._partialmatch(). Also, I'll probably make
some changes to resolvehexnodeidprefix() later, and I want those to be
reflected by the id() predicate.
Note that this breaks a test case, because we now resolve the prefix
in the unfiltered repo and get an ambiguous lookup, which results in
no revision being added to the revset. The test case was already
documented to be broken even though it wasn't. It's important to note
that {shortest(node)} already uses the unfiltered repo, so we're not
going to break people who get the prefix from there.
I think we may not want to ever use shortest() in the filtered
repo. It seems unlikely to be enough of a win to matter much. For
example, in my hg repo, it would save me only 0.2 hex digits. In
another repo that only I modify, it saves a little more, but it's
still only 0.29 hex digits. It seems unlikely that people will prune
enough commits that only 1/16 of the commits are visible (which is
what it would take a to save a single hex digit). Instead, I'm working
on another approach: allow ambiguous matches to be disambiguated
within a user-specified revset. Whether or not that pans out, I hope
we're okay with this little change in behavior for now and we can
decide what to do about it later.
Differential Revision: https://phab.mercurial-scm.org/D3311
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 07 May 2018 14:32:55 -0700 |
parents | 37e7ae332e90 |
children | 69de3c3de036 |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Mon May 07 14:32:43 2018 -0700 +++ b/mercurial/revset.py Mon May 07 14:32:55 2018 -0700 @@ -1333,7 +1333,7 @@ else: rn = None try: - pm = repo.changelog._partialmatch(n) + pm = scmutil.resolvehexnodeidprefix(repo, n) if pm is not None: rn = repo.changelog.rev(pm) except LookupError:
--- a/tests/test-revset.t Mon May 07 14:32:43 2018 -0700 +++ b/tests/test-revset.t Mon May 07 14:32:55 2018 -0700 @@ -1874,9 +1874,9 @@ $ hg debugrevspec '0:wdir() & fffb' abort: 00changelog.i@fffb: ambiguous identifier! [255] -BROKEN should be '2' (node lookup uses unfiltered repo since dc25ed84bee8) +BROKEN should be '2' (node lookup uses unfiltered repo) $ hg debugrevspec '0:wdir() & id(fffb)' - 2 +BROKEN should be '2' (node lookup uses unfiltered repo) $ hg debugrevspec '0:wdir() & ffff8' 4 $ hg debugrevspec '0:wdir() & fffff'