Patchwork [4,of,4] rust-ancestors: adjust branches and inline comments per previous change

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 6, 2019, 3:54 a.m.
Message ID <16fb6aa9ffcb433f133d.1546746847@mimosa>
Download mbox | patch
Permalink /patch/37493/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 6, 2019, 3:54 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1545225860 -32400
#      Wed Dec 19 22:24:20 2018 +0900
# Node ID 16fb6aa9ffcb433f133dd4ca3475cff60c204754
# Parent  b1f97e06bd1e0923165a16a6ba4894feadf735c0
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.
Augie Fackler - Jan. 8, 2019, 2:11 a.m.
On Sun, Jan 06, 2019 at 12:54:07PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1545225860 -32400
> #      Wed Dec 19 22:24:20 2018 +0900
> # Node ID 16fb6aa9ffcb433f133dd4ca3475cff60c204754
> # Parent  b1f97e06bd1e0923165a16a6ba4894feadf735c0
> rust-ancestors: adjust branches and inline comments per previous change

queued, thanks

Patch

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<G: Graph> MissingAncestors<G> {
                     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<G: Graph> MissingAncestors<G> {
                         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();