##// END OF EJS Templates
rust-ancestors: duplicate loop that visits parents of revs/bases...
Yuya Nishihara -
r41168:55dc1da8 default
parent child Browse files
Show More
@@ -345,14 +345,6 b' impl<G: Graph> MissingAncestors<G> {'
345 if revs_visit.remove(&curr) {
345 if revs_visit.remove(&curr) {
346 missing.push(curr);
346 missing.push(curr);
347 this_visit_is_revs = true;
347 this_visit_is_revs = true;
348 } else if bases_visit.contains(&curr) {
349 this_visit_is_revs = false;
350 } else {
351 // not an ancestor of revs or bases: ignore
352 continue;
353 }
354
355 {
356 for p in self.graph.parents(curr)?.iter().cloned() {
348 for p in self.graph.parents(curr)?.iter().cloned() {
357 if p == NULL_REVISION {
349 if p == NULL_REVISION {
358 continue;
350 continue;
@@ -378,6 +370,35 b' impl<G: Graph> MissingAncestors<G> {'
378 }
370 }
379 }
371 }
380 }
372 }
373 } else if bases_visit.contains(&curr) {
374 this_visit_is_revs = false;
375 for p in self.graph.parents(curr)?.iter().cloned() {
376 if p == NULL_REVISION {
377 continue;
378 }
379 let in_other_visit = if this_visit_is_revs {
380 bases_visit.contains(&p)
381 } else {
382 revs_visit.contains(&p)
383 };
384 if in_other_visit || both_visit.contains(&p) {
385 // p is implicitely in this_visit.
386 // This means p is or should be in bothvisit
387 // TODO optim: hence if bothvisit, we look up twice
388 revs_visit.remove(&p);
389 bases_visit.insert(p);
390 both_visit.insert(p);
391 } else {
392 // visit later
393 if this_visit_is_revs {
394 revs_visit.insert(p);
395 } else {
396 bases_visit.insert(p);
397 }
398 }
399 }
400 } else {
401 // not an ancestor of revs or bases: ignore
381 }
402 }
382 }
403 }
383 missing.reverse();
404 missing.reverse();
General Comments 0
You need to be logged in to leave comments. Login now