[PATCH evolve-ext] directaccess: inspect trees of len() > 3
Durham Goode
durham at fb.com
Tue Sep 29 16:56:43 UTC 2015
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1443545230 25200
# Tue Sep 29 09:47:10 2015 -0700
# Node ID abecad535914b59b11c3513e822216a2e4e4f69a
# Parent a55c691f4cc0b960a02bc94b3296403524c8db84
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.
diff --git a/hgext/directaccess.py b/hgext/directaccess.py
--- a/hgext/directaccess.py
+++ b/hgext/directaccess.py
@@ -152,8 +152,11 @@ def gethashsymbols(tree):
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 []
diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -358,6 +358,13 @@ But only with hash
[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
More information about the Mercurial-devel
mailing list