diff hgext/largefiles/overrides.py @ 23644:17b2ab77f453

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 22 Dec 2014 17:26:21 -0600
parents 7fd1a6c27e60 70afc58c32d3
children 0297d8469350
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Thu Dec 11 22:51:29 2014 -0800
+++ b/hgext/largefiles/overrides.py	Mon Dec 22 17:26:21 2014 -0600
@@ -22,6 +22,18 @@
 
 # -- Utility functions: commonly/repeatedly needed functionality ---------------
 
+def composelargefilematcher(match, manifest):
+    '''create a matcher that matches only the largefiles in the original
+    matcher'''
+    m = copy.copy(match)
+    lfile = lambda f: lfutil.standin(f) in manifest
+    m._files = filter(lfile, m._files)
+    m._fmap = set(m._files)
+    m._always = False
+    origmatchfn = m.matchfn
+    m.matchfn = lambda f: lfile(f) and origmatchfn(f)
+    return m
+
 def composenormalfilematcher(match, manifest):
     m = copy.copy(match)
     notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
@@ -146,7 +158,8 @@
     after = opts.get('after')
     if not pats and not after:
         raise util.Abort(_('no files specified'))
-    m = scmutil.match(repo[None], pats, opts)
+    m = composelargefilematcher(scmutil.match(repo[None], pats, opts),
+                                repo[None].manifest())
     try:
         repo.lfstatus = True
         s = repo.status(match=m, clean=True)
@@ -950,7 +963,8 @@
     installnormalfilesmatchfn(repo[None].manifest())
     result = orig(ui, repo, *pats, **opts)
     restorematchfn()
-    m = scmutil.match(repo[None], pats, opts)
+    m = composelargefilematcher(scmutil.match(repo[None], pats, opts),
+                                repo[None].manifest())
 
     try:
         repo.lfstatus = True