[PATCH 7 of 8 sparse V2] dirstate: move customizations to rebuild() from sparse extension

Martin von Zweigbergk martinvonz at google.com
Tue Jul 11 02:11:36 EDT 2017


On Mon, Jul 10, 2017 at 9:57 PM, Gregory Szorc <gregory.szorc at gmail.com> wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1499537680 25200
> #      Sat Jul 08 11:14:40 2017 -0700
> # Node ID f0ef4aff7559a680e216407e5822e3e281ef1a5f
> # Parent  7b09c7c8f8457dd96f45334dad13a0ceaae92a18
> dirstate: move customizations to rebuild() from sparse extension
>
> This is a pretty straightforward port of the monkeypatch from
> sparse directly into dirstate.
>
> Unless the sparse feature is enabled via the sparse extension,
> the sparse matcher will be an alwaysmatcher and the added
> branch won't be taken.
>
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -774,6 +774,19 @@ class dirstate(object):
>          self._dirty = True
>
>      def rebuild(self, parent, allfiles, changedfiles=None):
> +        # Filter allfiles and changedfiles through a sparse matcher if it is
> +        # active.
> +        matcher = self._sparsematcher
> +        if not matcher.always():
> +            allfiles = allfiles.matches(matcher)

This seems to assume that allfiles is a manifest (where matches() is
defined). It looks like all in-tree callers do pass a manifest, but
this patch should at least have an (API) marker. Maybe we should
rename the argument to "mf" too.


More information about the Mercurial-devel mailing list