[PATCH 1 of 2] ancestor: a new algorithm for ancestors of a not in b that is faster when a and b are close

Siddharth Agarwal sid0 at fb.com
Wed Nov 21 13:13:45 CST 2012


On 11/21/2012 07:47 AM, Pierre-Yves David wrote:
> The function seems ok but what it does sound very similar to what discovery does. But did you had a look to the discovery code ? I'm not sure we can mutualise anything since discovery is optimized toward roundtrip. But still…

Good point -- I found revlog.findmissing() which I'm going to switch to 
using this instead of its current two walks up the DAG.
> 1) seems like a for loop with an extra break clause.
> 2) I think you could stop with avisit is empty.
>     Once it's empty you won't find additional ancestors for a.

Yes, good point.

> Does this mean that "a" can't be and ancestors of "b"?
> you should HIGHLIGHT that in the docstring!

If a is an ancestor of b, an empty list is returned (as one would 
expect). This is covered by the doctests, but it might make sense to add 
it to the docstring as well.


More information about the Mercurial-devel mailing list