[PATCH 2 of 5] filectx.parents: enforce changeid of parent to be in own changectx ancestors

Matt Mackall mpm at selenic.com
Tue Dec 30 17:43:13 CST 2014


On Tue, 2014-12-30 at 13:37 -0800, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1419377438 28800
> #      Tue Dec 23 15:30:38 2014 -0800
> # Node ID d514ca98fbf1a73adc725d48dfe0a8a49b7fd82f
> # Parent  88ec1cc5c6f5b3281d46e440ba1e70dbf14d18eb
> filectx.parents: enforce changeid of parent to be in own changectx ancestors

> +def _adjustlinkrev(repo, path, filelog, fnode, srcrev):
> +    """return the first ancestor of <srcrev> introducting <fnode>
> +
> +    If the linkrev of the file revision does not point to an ancestor of
> +    srcrev, we'll walk down the ancestors until we found one introducing this
> +    file revision.
> +
> +    :repo: a localrepository object (used to access changelog and manifest)
> +    :path: the file path
> +    :fnode: the nodeid of the file revision
> +    :filelog: the filelog of this path
> +    :srcrev: the changeset revision we search ancestors from
> +    """

This looks like a less advanced version of this code:

http://markmail.org/message/epp4ac5zr26beyq6

For starters, yours is O(all ancestors), even in the trivial case of
ctx[foo].linkrev == ctx.rev().

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list