Mercurial > evolve
comparison hgext/directaccess.py @ 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 | f869033391b9 |
children | 50e683d9835e |
comparison
equal
deleted
inserted
replaced
1507:6f574c76c142 | 1508:8dfb88ca0c08 |
---|---|
150 result = [] | 150 result = [] |
151 for entry in tree[2][1].split('\0'): | 151 for entry in tree[2][1].split('\0'): |
152 if hashre.match(entry): | 152 if hashre.match(entry): |
153 result.append(entry) | 153 result.append(entry) |
154 return result | 154 return result |
155 elif len(tree) == 3: | 155 elif len(tree) >= 3: |
156 return gethashsymbols(tree[1]) + gethashsymbols(tree[2]) | 156 results = [] |
157 for subtree in tree[1:]: | |
158 results += gethashsymbols(subtree) | |
159 return results | |
157 else: | 160 else: |
158 return [] | 161 return [] |
159 | 162 |
160 def _posttreebuilthook(orig, tree, repo): | 163 def _posttreebuilthook(orig, tree, repo): |
161 # This is use to enabled direct hash access | 164 # This is use to enabled direct hash access |