[PATCH] [discovery] simplify branchmap construction again legacy server

Matt Mackall mpm at selenic.com
Thu Jun 21 16:35:19 CDT 2012


On Sat, 2012-06-16 at 13:16 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1339845206 -7200
> # Node ID 6ae00ea2cd3290a45d71e7b57b0eb4fb17affca5
> # Parent  2255950e1f7663a9faa6b57040cc5c0debe7d4dd
> [discovery] simplify branchmap construction again legacy server

This has a non-standard summary.

> All necessary data to fire a simple revset query are already known. No call to
> ancestor are needed. Such ancestor calculation was already done to compute
> outgoing.missing.
> 
> This changeset add test written by Joshua Redstone (<joshua.redstone at fb.com>).
> 
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -208,15 +208,8 @@
>          # 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:
> -                    continue
> -                minhrev = min(cl.rev(h) for h in newheads)
> -                reachable = cl.reachable(latest, cl.node(minhrev))
> -                reachable.remove(latest)
> -                newheads.difference_update(reachable)
> +        rvset = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing)
> +        newheads = set(c.node() for c in rvset)

Just naming this variable 'r' would have been better than inventing a
weird new abbreviation. It's certainly not a set of revs, nor a set of
recreational vehicles, it's a generator of contexts.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list