mercurial/scmutil.py
changeset 37504 901e749ca0e1
parent 37463 bbd240f81ac5
child 37527 1c09481acdcc
--- a/mercurial/scmutil.py	Mon Mar 19 20:23:27 2018 +0900
+++ b/mercurial/scmutil.py	Sun Apr 08 08:06:34 2018 -0700
@@ -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)