[PATCH 4 of 6 v8] discovery: convert legacy part of checkheads to revs from nodes

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jun 19 18:18:11 CDT 2012


On 19 juin 2012, at 22:21, Joshua Redstone wrote:

> # HG changeset patch
> # User Joshua Redstone <joshua.redstone at fb.com>
> # Date 1339190611 25200
> # Node ID 5404ca79c3b310e3f2ee79960676e7a8c610e7d7
> # Parent  360c7136e67a6843f2cc53b6a2eba33ac8d84fa2
> discovery: convert legacy part of checkheads to revs from nodes
> 
> After a recent switch from revlog.reachable to revlog.ancestors,
> clean up this old call site, switching it from nodes to revs.

Considerer applying this change first http://selenic.com/pipermail/mercurial-devel/2012-June/041555.html

You won't have any call to revlog.reachable left at all.

> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -207,19 +207,18 @@
>         # 1-4b. old servers: Check for new topological heads.
>         # Construct {old,new}map with branch = None (topological branch).
>         # (code based on _updatebranchcache)
> -        oldheads = set(h for h in remoteheads if h in cl.nodemap)
> -        newheads = oldheads.union(outgoing.missing)
> -        if len(newheads) > 1:
> -            for latest in reversed(outgoing.missing):
> -                if latest not in newheads:
> +        oldheadrevs = set(cl.rev(h) for h in remoteheads if h in cl.nodemap)
> +        missingrevs = [cl.rev(node) for node in outgoing.missing]
> +        newheadrevs = oldheadrevs.union(missingrevs)
> +        if len(newheadrevs) > 1:
> +            for latest in sorted(missingrevs, reverse=True):

Do not sort that. It's already sorted, just reverse it

+            missingrevs.reverse()
+            for latest in missingrevs:

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list