[PATCH 1 of 8] largefiles: split the creation of a normal matcher out of its install method

Augie Fackler raf at durin42.com
Tue Dec 2 15:55:47 UTC 2014


On Wed, Nov 26, 2014 at 08:12:14PM -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1416626685 18000
> #      Fri Nov 21 22:24:45 2014 -0500
> # Node ID 36938964dbce5fc575dce8d6c07d4aec4d3d8af3
> # Parent  b5e2128ce9e6cc0b6a2b20cc2763f9e6c351625b
> largefiles: split the creation of a normal matcher out of its install method

This one seems virtuous on its own, so I'm going to go ahead and queue it.

I picked up Martin's patch, so I'll do a review of the rest of this
series, but you should plan for a v3 once you see this patch make it
to mpm's repo.

>
> Refactoring addremove to support subrepos will need the ability to keep passing
> the same matcher and narrowing it, instead of monkey patching scmutil's matcher.
>
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -22,20 +22,23 @@
>
>  # -- Utility functions: commonly/repeatedly needed functionality ---------------
>
> +def composenormalfilematcher(match, manifest):
> +    m = copy.copy(match)
> +    notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
> +            manifest)
> +    m._files = filter(notlfile, m._files)
> +    m._fmap = set(m._files)
> +    m._always = False
> +    origmatchfn = m.matchfn
> +    m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
> +    return m
> +
>  def installnormalfilesmatchfn(manifest):
>      '''installmatchfn with a matchfn that ignores all largefiles'''
>      def overridematch(ctx, pats=[], opts={}, globbed=False,
>              default='relpath'):
>          match = oldmatch(ctx, pats, opts, globbed, default)
> -        m = copy.copy(match)
> -        notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
> -                manifest)
> -        m._files = filter(notlfile, m._files)
> -        m._fmap = set(m._files)
> -        m._always = False
> -        origmatchfn = m.matchfn
> -        m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
> -        return m
> +        return composenormalfilematcher(match, manifest)
>      oldmatch = installmatchfn(overridematch)
>
>  def installmatchfn(f):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list