changeset 1508:8dfb88ca0c08

directaccess: inspect trees of len() > 3 Previously, when inspecting revset AST's we'd only traverse down the tree if it was length 3 ([op, left, right]). In some situations, like 'or' the tree node will be greater than length 3 ([op, first, second, ..., nth]). So we need to traverse all the parts of the node to catch all the symbols.
author Durham Goode <durham@fb.com>
date Tue, 29 Sep 2015 09:47:10 -0700
parents 6f574c76c142
children 405be3783fbc
files hgext/directaccess.py tests/test-inhibit.t
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/directaccess.py	Mon Sep 21 22:30:44 2015 +0900
+++ b/hgext/directaccess.py	Tue Sep 29 09:47:10 2015 -0700
@@ -152,8 +152,11 @@
             if hashre.match(entry):
                 result.append(entry)
         return result
-    elif len(tree) == 3:
-        return gethashsymbols(tree[1]) + gethashsymbols(tree[2])
+    elif len(tree) >= 3:
+        results = []
+        for subtree in tree[1:]:
+            results += gethashsymbols(subtree)
+        return results
     else:
         return []
 
--- a/tests/test-inhibit.t	Mon Sep 21 22:30:44 2015 +0900
+++ b/tests/test-inhibit.t	Tue Sep 29 09:47:10 2015 -0700
@@ -358,6 +358,13 @@
   [255]
 
 
+Test directaccess in a larger revset
+
+  $ hg log -r '. + .^ + 2db36d8066ff' -T '{node|short}\n'
+  55c73a90e4b4
+  cf5c4f4554ce
+  2db36d8066ff
+
 With severals hidden sha, rebase of one hidden stack onto another one:
   $ hg update -C 0
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved