# HG changeset patch # User Yuya Nishihara # Date 2018-12-19 13:24:20 # Node ID 17a1956764728e8c9dd1101573dca12523e482bb # Parent a1b3800c8a197bb2e47990e406911a144938428d rust-ancestors: adjust branches and inline comments per previous change Now the top-level "if" can be read as both_visit|revs_visit|bases_visit. diff --git a/rust/hg-core/src/ancestors.rs b/rust/hg-core/src/ancestors.rs --- a/rust/hg-core/src/ancestors.rs +++ b/rust/hg-core/src/ancestors.rs @@ -336,17 +336,15 @@ impl MissingAncestors { bases_visit.insert(p); both_visit.insert(p); } - continue; - } - if revs_visit.remove(&curr) { + } else if revs_visit.remove(&curr) { missing.push(curr); for p in self.graph.parents(curr)?.iter().cloned() { if p == NULL_REVISION { continue; } if bases_visit.contains(&p) || both_visit.contains(&p) { - // p is implicitely in this_visit. - // This means p is or should be in bothvisit + // p is an ancestor of revs_visit, and is implicitly + // in bases_visit, which means p is ::revs & ::bases. // TODO optim: hence if bothvisit, we look up twice revs_visit.remove(&p); bases_visit.insert(p); @@ -362,19 +360,16 @@ impl MissingAncestors { continue; } if revs_visit.contains(&p) || both_visit.contains(&p) { - // p is implicitely in this_visit. - // This means p is or should be in bothvisit + // p is an ancestor of bases_visit, and is implicitly + // in revs_visit, which means p is ::revs & ::bases. // TODO optim: hence if bothvisit, we look up twice revs_visit.remove(&p); bases_visit.insert(p); both_visit.insert(p); } else { - // visit later bases_visit.insert(p); } } - } else { - // not an ancestor of revs or bases: ignore } } missing.reverse();