[PATCH 04 of 11 sparse] sparse: refactor activeprofiles into a generic function (API)
Martin von Zweigbergk
martinvonz at google.com
Mon Jul 10 22:07:50 UTC 2017
On Sat, Jul 8, 2017 at 4:28 PM, Gregory Szorc <gregory.szorc at gmail.com> wrote:
> diff --git a/mercurial/sparse.py b/mercurial/sparse.py
> --- a/mercurial/sparse.py
> +++ b/mercurial/sparse.py
> @@ -124,15 +124,26 @@ def patternsforrev(repo, rev):
>
> return includes, excludes, profiles
>
> -def activeprofiles(repo):
> +def activeconfig(repo):
> + """Determine the active sparse config rules.
> +
> + Rules are constructed by reading the current sparse config and bringing in
> + referenced profiles from parents of the working directory.
> + """
> revs = [repo.changelog.rev(node) for node in
> repo.dirstate.parents() if node != nullid]
>
> - profiles = set()
> + allincludes = set()
> + allexcludes = set()
> + allprofiles = set()
> +
> for rev in revs:
> - profiles.update(patternsforrev(repo, rev)[2])
> + includes, excludes, profiles = patternsforrev(repo, rev)
> + allincludes |= includes
> + allexcludes |= excludes
> + allprofiles |= set(profiles)
Feel like changing parseconfig() to return profiles as set too (in a
followup)? I couldn't see a reason that it shouldn't be.
More information about the Mercurial-devel
mailing list