[PATCH 3 of 6 V2] merge: move foreground logic earlier

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Jan 13 03:49:40 CST 2014


On 01/12/2014 02:25 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1389549596 21600
> #      Sun Jan 12 11:59:56 2014 -0600
> # Node ID 460212c85977dbeec5007558fa26293a4a0d11f4
> # Parent  1908bcdb50a7b4be9eca3e90274365355783efe7
> merge: move foreground logic earlier
>
> This changeset doesn't change any previous logic. It is mainly prepatory work
> for the next few changesets which will use this foreground calculation for
> guessing which head to update to.

I would like more details on the motivation to move this forward.
This is preparatory work for a high-level goal. But how will it helps 
its implementation?

> […]
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> […]
> @@ -733,14 +742,12 @@ def update(repo, node, branchmerge, forc
>                   return 0, 0, 0, 0
>   
>               if pa not in (p1, p2):  # nonlinear
>                   dirty = wc.dirty(missing=True)
>                   if dirty or onode is None:
> -                    # Branching is a bit strange to ensure we do the minimal
> -                    # amount of call to obsolete.background.
> -                    foreground = obsolete.foreground(repo, [p1.node()])
> -                    # note: the <node> variable contains a random identifier
> +                    if foreground is None:
> +                        foreground = obsolete.foreground(repo, [p1.node()])

You want a comment here about when and why foreground can be None.



More information about the Mercurial-devel mailing list