D5416: rust: translation of missingancestors
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Wed Dec 19 08:57:06 EST 2018
yuja added a comment.
> > + // in Rust, one can't just use mutable variables assignation
> > + // to be more straightforward. Instead of Python's
> > + // thisvisit and othervisit, we'll differentiate with a boolean
> > + let this_visit_is_revs = {
> > + if revs_visit.remove(&curr) {
> > + missing.push(curr);
> > + true
> > + } else if bases_visit.contains(&curr) {
> > + false
> > + } else {
> > + // not an ancestor of revs or bases: ignore
> > + continue;
> > + }
> > + };
>
> Maybe this could be extracted to a function
> `visit_parents(&mut revs_visit, &mut bases_visit, select_this, select_other)`
> where `select_this` and `select_other` are `FnMut(&mut, &mut) -> &mut`, but
> I don't know if that will improve the readability.
Actually it looks better if I copy-paste the visit loop. I'll send follow-up
patches.
if both_visit.contains(&curr) {
for p in ...
} else if revs_visit.remove(&curr) {
missing.push(curr);
for p in ...
} else if bases_visit.contains(&curr) {
for p in ...
}
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5416
To: gracinet, #hg-reviewers
Cc: yuja, durin42, kevincox, mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list