[PATCH 3 of 3] largefiles: avoid match.files() in conditions

Augie Fackler raf at durin42.com
Wed May 27 00:08:47 CDT 2015


On Tue, May 26, 2015 at 03:09:27PM -0500, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1432066101 25200
> #      Tue May 19 13:08:21 2015 -0700
> # Node ID a90f80fe03ed6d5e88c67a525b0e4355a50abf2a
> # Parent  b7fd42dc282467841f30eb98c921c8202c66b9b0
> largefiles: avoid match.files() in conditions

Queued these, thanks

>
> See 9789b4a7c595 (match: introduce boolean prefix() method,
> 2014-10-28) for reasons to avoid match.files() in conditions.
>
> diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
> --- a/hgext/largefiles/lfutil.py
> +++ b/hgext/largefiles/lfutil.py
> @@ -241,13 +241,15 @@
>  def getstandinmatcher(repo, rmatcher=None):
>      '''Return a match object that applies rmatcher to the standin directory'''
>      standindir = repo.wjoin(shortname)
> -    if rmatcher and rmatcher.files():
> +    if rmatcher and not rmatcher.always():
>          pats = [os.path.join(standindir, pat) for pat in rmatcher.files()]
> +        match = scmutil.match(repo[None], pats)
> +        # if pats is empty, it would incorrectly always match, so clear _always
> +        match._always = False
>      else:
>          # no patterns: relative to repo root
> -        pats = [standindir]
> +        match = scmutil.match(repo[None], [standindir])
>      # no warnings about missing files or directories
> -    match = scmutil.match(repo[None], pats)
>      match.bad = lambda f, msg: None
>      return match
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list