[PATCH 7 of 7] largefiles: use the optional badfn argument when building a matcher

Martin von Zweigbergk martinvonz at google.com
Mon Jun 8 11:52:07 CDT 2015


I've pushed this to the clowncopter, thanks.

There are still 3 cases of ".bad = " in the codebase. Did you intentionally
not update those? Will they be dealt with in another series?

On Fri, Jun 5, 2015 at 9:00 PM Matt Harbison <mharbison72 at gmail.com> wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1433559195 14400
> #      Fri Jun 05 22:53:15 2015 -0400
> # Node ID 2e18852e1324a67455c39a1a39b5a2c266c1d387
> # Parent  63faca7efc382bd10477106373596e81b7129576
> largefiles: use the optional badfn argument when building a matcher
>
> The monkey patching in cat() can't be fixed, because it still delegates to
> the
> original bad().  Overriding commands.cat() should go away in favor
> overriding
> cmdutil.cat() anyway, and that matcher can be wrapped with
> matchmod.badmatch().
>
> diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
> --- a/hgext/largefiles/lfutil.py
> +++ b/hgext/largefiles/lfutil.py
> @@ -241,16 +241,18 @@
>  def getstandinmatcher(repo, rmatcher=None):
>      '''Return a match object that applies rmatcher to the standin
> directory'''
>      standindir = repo.wjoin(shortname)
> +
> +    # no warnings about missing files or directories
> +    badfn = lambda f, msg: None
> +
>      if rmatcher and not rmatcher.always():
>          pats = [os.path.join(standindir, pat) for pat in rmatcher.files()]
> -        match = scmutil.match(repo[None], pats)
> +        match = scmutil.match(repo[None], pats, badfn=badfn)
>          # if pats is empty, it would incorrectly always match, so clear
> _always
>          match._always = False
>      else:
>          # no patterns: relative to repo root
> -        match = scmutil.match(repo[None], [standindir])
> -    # no warnings about missing files or directories
> -    match.bad = lambda f, msg: None
> +        match = scmutil.match(repo[None], [standindir], badfn=badfn)
>      return match
>
>  def composestandinmatcher(repo, rmatcher):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150608/b35a0c6a/attachment.html>


More information about the Mercurial-devel mailing list