( )⚙ D5944 rust: stop putting NULL_REVISION in MissingAncestors.bases

This is an archive of the discontinued Mercurial Phabricator instance.

rust: stop putting NULL_REVISION in MissingAncestors.bases
ClosedPublic

Authored by gracinet on Feb 12 2019, 7:02 AM.

Details

Summary

As noted in initial review of MissingAncestors, adding
NULL_REVISION in constructor in case the given bases is
empty wasn't really useful, yet it's been kept for identity
with the Python implementation

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gracinet created this revision.Feb 12 2019, 7:02 AM
kevincox accepted this revision.Feb 12 2019, 9:54 AM
kevincox added inline comments.
rust/hg-core/src/ancestors.rs
245

I think it would be more clear if you filtered the NULL_REVISION out before extending the set.

let new_bases = new_bases.into_iter().filter(|&rev| rev != NULL_REVISION);
self.bases.extend(new_bases);
gracinet updated this revision to Diff 14056.Feb 13 2019, 6:55 AM
This revision was automatically updated to reflect the committed changes.