revset_graph: avoid construction of edges if already known

The stack can contain duplicated entries, and we only need the last one to
resolve edges.
This commit is contained in:
Yuya Nishihara 2023-07-28 15:38:57 +09:00
parent beb997e85a
commit 1bf6ab5370

View file

@ -200,6 +200,10 @@ impl<'revset, 'index> RevsetGraphIterator<'revset, 'index> {
let mut stack = vec![index_entry];
while let Some(entry) = stack.last() {
let position = entry.position();
if self.edges.contains_key(&position) {
stack.pop().unwrap();
continue;
}
let mut edges = HashSet::new();
let mut parents_complete = true;
for parent in entry.parents() {