changeset 25293:ab618e52788a

largefiles: avoid match.files() in conditions See 9789b4a7c595 (match: introduce boolean prefix() method, 2014-10-28) for reasons to avoid match.files() in conditions.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 19 May 2015 13:08:21 -0700
parents 31d543cd7062
children 701df761aa94
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Tue May 26 11:06:43 2015 -0700
+++ b/hgext/largefiles/lfutil.py	Tue May 19 13:08:21 2015 -0700
@@ -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