directaccesss: also look for symbol into list
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 17 Aug 2015 17:01:38 -0700
changeset 1492 f869033391b9
parent 1491 8f469f81129c
child 1493 083220acba01
directaccesss: also look for symbol into list revrange is now much smarted and optimise multiple simple symbol (like hash) into an efficient '_list' call. So we need to look into these to find user provided input too.
hgext/directaccess.py
tests/test-inhibit.t
--- a/hgext/directaccess.py	Wed Aug 12 20:38:39 2015 -0700
+++ b/hgext/directaccess.py	Mon Aug 17 17:01:38 2015 -0700
@@ -129,6 +129,8 @@
 
 hashre = util.re.compile('[0-9a-fA-F]{1,40}')
 
+_listtuple = ('symbol', '_list')
+
 def gethashsymbols(tree):
     # Returns the list of symbols of the tree that look like hashes
     # for example for the revset 3::abe3ff it will return ('abe3ff')
@@ -143,6 +145,13 @@
             if hashre.match(tree[1]):
                 return [tree[1]]
             return []
+    elif tree[0] == "func" and tree[1] == _listtuple:
+        # the optimiser will group sequence of hash request
+        result = []
+        for entry in tree[2][1].split('\0'):
+            if hashre.match(entry):
+                result.append(entry)
+        return result
     elif len(tree) == 3:
         return gethashsymbols(tree[1]) + gethashsymbols(tree[2])
     else:
--- a/tests/test-inhibit.t	Wed Aug 12 20:38:39 2015 -0700
+++ b/tests/test-inhibit.t	Mon Aug 17 17:01:38 2015 -0700
@@ -404,8 +404,7 @@
   [255]
   $ hg rebase -r ad78ff7d621f -r 53a94305e133 -d  2db36d8066ff
   Warning: accessing hidden changesets 2db36d8066ff for write operation
-  Warning: accessing hidden changesets ad78ff7d621f for write operation
-  Warning: accessing hidden changesets 53a94305e133 for write operation
+  Warning: accessing hidden changesets ad78ff7d621f,53a94305e133 for write operation
   rebasing 10:ad78ff7d621f "add cK"
   rebasing 11:53a94305e133 "add cL"
   $ hg log -G