D5415: rust: changed Graph.parents to return [Revision; 2]
kevincox (Kevin Cox)
phabricator at mercurial-scm.org
Wed Dec 12 11:11:15 EST 2018
kevincox added a comment.
This is a nice improvement. It still seems odd to me to return a list of two parents when there could be 0, 1 or 2 parents. I guess this is for performance reasons?
INLINE COMMENTS
> ancestors.rs:62
> + this.conditionally_push_rev(parents[0]);
> + this.conditionally_push_rev(parents[1]);
> }
I would do `let [p1, p2]` still as it shows the reader that you handled all the nodes. Alternatively loop over them all.
for parent in this.graph.parents(rev)? {
this.conditionally_push_rev(parent);
}
> ancestors.rs:118
> };
> - let (p1, p2) = match self.graph.parents(current) {
> + let parents = match self.graph.parents(current) {
> Ok(ps) => ps,
let [p1, p2] = ...
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5415
To: gracinet, #hg-reviewers
Cc: durin42, kevincox, mercurial-devel
More information about the Mercurial-devel
mailing list