largefiles: pass in whole matcher to getstandinmatcher()
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 26 May 2015 11:06:43 -0700
changeset 25292 31d543cd7062
parent 25291 85f1aaf18ecb
child 25293 ab618e52788a
largefiles: pass in whole matcher to getstandinmatcher() The choice between the "always" case and the other case is done in getstandinmatcher() and the next patch will change how it's determined based on the matcher, so let's prepare by passing in the matcher, not just the matcher's files.
hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py	Tue May 26 09:46:48 2015 -0700
+++ b/hgext/largefiles/lfutil.py	Tue May 26 11:06:43 2015 -0700
@@ -238,11 +238,11 @@
     if path:
         link(storepath(repo, hash), path)
 
-def getstandinmatcher(repo, pats=[]):
-    '''Return a match object that applies pats to the standin directory'''
+def getstandinmatcher(repo, rmatcher=None):
+    '''Return a match object that applies rmatcher to the standin directory'''
     standindir = repo.wjoin(shortname)
-    if pats:
-        pats = [os.path.join(standindir, pat) for pat in pats]
+    if rmatcher and rmatcher.files():
+        pats = [os.path.join(standindir, pat) for pat in rmatcher.files()]
     else:
         # no patterns: relative to repo root
         pats = [standindir]
@@ -255,7 +255,7 @@
     '''Return a matcher that accepts standins corresponding to the
     files accepted by rmatcher. Pass the list of files in the matcher
     as the paths specified by the user.'''
-    smatcher = getstandinmatcher(repo, rmatcher.files())
+    smatcher = getstandinmatcher(repo, rmatcher)
     isstandin = smatcher.matchfn
     def composedmatchfn(f):
         return isstandin(f) and rmatcher.matchfn(splitstandin(f))