From c6004ab0e0973db292222dce3b26a37f9dc1327b Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Wed, 24 Nov 2021 02:59:55 +0800 Subject: [PATCH] fixed odd orders --- src/tree.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tree.py b/src/tree.py index 9dc5fe2..bb8e879 100644 --- a/src/tree.py +++ b/src/tree.py @@ -247,8 +247,12 @@ class TreeWalker: return config def ensure_node_id(self, config): - if "node_id" not in config: - config["node_id"] = self.gen_node_id() + if "node_id" not in config or \ + not config["node_id"].startswith(f"{self.tree}-") or \ + config["node_id"] in id_set: + new_id = self.gen_node_id() + id_set.add(new_id) + config["node_id"] = new_id return True, config else: return False, config -- GitLab