[PATCH 6 of 6 V2] merge: invoke cmdutil.fileprefetchhooks() prior to applying updates

Yuya Nishihara yuya at tcha.org
Mon Feb 12 05:29:05 EST 2018


On Sun, 11 Feb 2018 22:58:08 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1518373556 18000
> #      Sun Feb 11 13:25:56 2018 -0500
> # Node ID add5bc8012bbedd24d2b9d3a301bfe0eba892ca4
> # Parent  d05ecbfd419747d580100f86a3ffdc3b85574166
> merge: invoke cmdutil.fileprefetchhooks() prior to applying updates
> 
> This moves the file list calculation into core, so other extensions don't need
> to duplicate it.
> 
> An alternative to the local import is maybe doing something similar to the
> localrepo.prepushoutgoinghooks property.  But both of these things seem like
> special cases, and I have no idea which is better/preferred.

> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -1385,6 +1385,19 @@
>      if i > 0:
>          yield i, f
>  
> +def _prefetchfiles(repo, ctx, actions):
> +    """Invoke ``cmdutil.fileprefetchhooks()`` for the files relevant to the dict
> +    of merge actions.  ``ctx`` is the context being merged in."""
> +
> +    # avoid import cycle
> +    from . import cmdutil

cmdutil->merge is reverse dependency. Maybe prefetchfiles() could be moved
to scmutil?


More information about the Mercurial-devel mailing list