diff mercurial/revset.py @ 32684:af854b1b36f8

revlog: add support for partial matching of wdir node id The idea is simple. If the given node id prefix is 'ff...f', add +1 to the number of matches (e.g. ambiguous if partial + maybewdir > 1). This patch also fixes id() revset and shortest() template since _partialmatch() can raise WdirUnsupported exception.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 19 Aug 2016 18:26:04 +0900
parents 9f840d99054c
children f75d0aa5dc83
line wrap: on
line diff
--- a/mercurial/revset.py	Sat Aug 20 18:15:19 2016 +0900
+++ b/mercurial/revset.py	Fri Aug 19 18:26:04 2016 +0900
@@ -1309,12 +1309,12 @@
             rn = None
     else:
         rn = None
-        pm = repo.changelog._partialmatch(n)
-        if pm is not None:
-            try:
+        try:
+            pm = repo.changelog._partialmatch(n)
+            if pm is not None:
                 rn = repo.changelog.rev(pm)
-            except error.WdirUnsupported:
-                rn = node.wdirrev
+        except error.WdirUnsupported:
+            rn = node.wdirrev
 
     if rn is None:
         return baseset()