D3189: context: extract partial nodeid lookup method to scmutil
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Apr 10 12:03:32 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG901e749ca0e1: context: extract partial nodeid lookup method to scmutil (authored by martinvonz, committed by ).
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D3189?vs=7878&id=7934#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D3189?vs=7878&id=7934
REVISION DETAIL
https://phab.mercurial-scm.org/D3189
AFFECTED FILES
mercurial/context.py
mercurial/scmutil.py
CHANGE DETAILS
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -433,6 +433,15 @@
hexfunc = short
return '%d:%s' % (rev, hexfunc(node))
+def resolvepartialhexnodeid(repo, prefix):
+ # Uses unfiltered repo because it's faster when then prefix is ambiguous/
+ # This matches the "shortest" template function.
+ node = repo.unfiltered().changelog._partialmatch(prefix)
+ if node is None:
+ return
+ repo.changelog.rev(node) # make sure node isn't filtered
+ return node
+
def isrevsymbol(repo, symbol):
try:
revsymbol(repo, symbol)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -450,7 +450,7 @@
except KeyError:
pass
- self._node = repo.unfiltered().changelog._partialmatch(changeid)
+ self._node = scmutil.resolvepartialhexnodeid(repo, changeid)
if self._node is not None:
self._rev = repo.changelog.rev(self._node)
return
To: martinvonz, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list