rust-ancestors: adjust branches and inline comments per previous change
authorYuya Nishihara <yuya@tcha.org>
Wed, 19 Dec 2018 22:24:20 +0900
changeset 41134 17a195676472
parent 41133 a1b3800c8a19
child 41135 050ea8eb42a5
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.
rust/hg-core/src/ancestors.rs
--- 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();