From ce3623978e34bead41012fa89f3e51c814b6a78d Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Fri, 18 May 2018 09:41:54 -0700 Subject: [PATCH] Merging children of DirListEntries now unifies the entries rather than just copying has_know_prefix --- bindings/bindingtester/tests/directory_util.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bindings/bindingtester/tests/directory_util.py b/bindings/bindingtester/tests/directory_util.py index d26c4776bd..7c2735b762 100644 --- a/bindings/bindingtester/tests/directory_util.py +++ b/bindings/bindingtester/tests/directory_util.py @@ -94,13 +94,19 @@ class DirListEntry: return subdir._add_child_impl(subpath[1:], child) def _merge_children(self, other): - for c in other.children: + if self == other: + return + other_children = other.children.copy() + for c in other_children: if c not in self.children: - self.children[c] = other.children[c] + self.children[c] = other_children[c] else: - self.children[c].has_known_prefix = self.children[c].has_known_prefix and other.children[c].has_known_prefix - self.children[c]._merge_children(other.children[c]) + # print('%d, %d. Merging child %r and %r' % (self.dir_id, other.dir_id, self.children[c].path, other_children[c].path)) + other_children[c].has_known_prefix = other_children[c].has_known_prefix and self.children[c].has_known_prefix + old_child = self.children[c] + self.children[c] = other_children[c] + old_child._merge_children(other_children[c]) def setup_directories(instructions, default_path, random): dir_list = [DirListEntry(True, False, True)]