changeset 41134:17a195676472

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.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 19 Dec 2018 22:24:20 +0900
parents a1b3800c8a19
children 050ea8eb42a5
files rust/hg-core/src/ancestors.rs
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/ancestors.rs	Wed Dec 19 21:52:40 2018 +0900
+++ b/rust/hg-core/src/ancestors.rs	Wed Dec 19 22:24:20 2018 +0900
@@ -336,17 +336,15 @@
                     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 @@
                         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();