[PATCH 8 of 9 sparse] sparse: move update action filtering into core

Martin von Zweigbergk martinvonz at google.com
Thu Jul 6 19:11:53 EDT 2017


On Thu, Jul 6, 2017 at 2:54 PM, Gregory Szorc <gregory.szorc at gmail.com> wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1499376320 25200
> #      Thu Jul 06 14:25:20 2017 -0700
> # Node ID 61066164673a2d4213bbfedc2081377b18f2d47c
> # Parent  fa3cd4d3ec8273b09e684c71aa716a85dcbe9f20
> sparse: move update action filtering into core
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -977,6 +977,9 @@ def calculateupdates(repo, wctx, mctx, a
>                       acceptremote, followcopies, matcher=None,
>                       mergeforce=False):
>      "Calculate the actions needed to merge mctx into wctx using ancestors"
> +    # Avoid cycle.
> +    from . import sparse
> +
>      if len(ancestors) == 1: # default
>          actions, diverge, renamedelete = manifestmerge(
>              repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
> @@ -1075,7 +1078,8 @@ def calculateupdates(repo, wctx, mctx, a
>          fractions = _forgetremoved(wctx, mctx, branchmerge)
>          actions.update(fractions)
>
> -    return actions, diverge, renamedelete
> +    return sparse.calculateupdates(repo, wctx, mctx, branchmerge, actions,
> +                                   diverge, renamedelete)

This reads a little funny. Maybe rename it to
sparse.filterupdatesactions()? Should we also make it return only the
filtered actions since "diverge" and "renamedelete" are not modified?
Seems like we don't even need to pass them into the method. Maybe
split this patch up into two as well (one that moves
calculateupdates() into core and one that changes its signature and
name and starts calling it from merge.py)?


More information about the Mercurial-devel mailing list