Mercurial > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
23642:7fd1a6c27e60 | 23644:17b2ab77f453 |
---|---|
19 import lfutil | 19 import lfutil |
20 import lfcommands | 20 import lfcommands |
21 import basestore | 21 import basestore |
22 | 22 |
23 # -- Utility functions: commonly/repeatedly needed functionality --------------- | 23 # -- Utility functions: commonly/repeatedly needed functionality --------------- |
24 | |
25 def composelargefilematcher(match, manifest): | |
26 '''create a matcher that matches only the largefiles in the original | |
27 matcher''' | |
28 m = copy.copy(match) | |
29 lfile = lambda f: lfutil.standin(f) in manifest | |
30 m._files = filter(lfile, m._files) | |
31 m._fmap = set(m._files) | |
32 m._always = False | |
33 origmatchfn = m.matchfn | |
34 m.matchfn = lambda f: lfile(f) and origmatchfn(f) | |
35 return m | |
24 | 36 |
25 def composenormalfilematcher(match, manifest): | 37 def composenormalfilematcher(match, manifest): |
26 m = copy.copy(match) | 38 m = copy.copy(match) |
27 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in | 39 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in |
28 manifest) | 40 manifest) |
144 | 156 |
145 def removelargefiles(ui, repo, isaddremove, *pats, **opts): | 157 def removelargefiles(ui, repo, isaddremove, *pats, **opts): |
146 after = opts.get('after') | 158 after = opts.get('after') |
147 if not pats and not after: | 159 if not pats and not after: |
148 raise util.Abort(_('no files specified')) | 160 raise util.Abort(_('no files specified')) |
149 m = scmutil.match(repo[None], pats, opts) | 161 m = composelargefilematcher(scmutil.match(repo[None], pats, opts), |
162 repo[None].manifest()) | |
150 try: | 163 try: |
151 repo.lfstatus = True | 164 repo.lfstatus = True |
152 s = repo.status(match=m, clean=True) | 165 s = repo.status(match=m, clean=True) |
153 finally: | 166 finally: |
154 repo.lfstatus = False | 167 repo.lfstatus = False |
948 | 961 |
949 def overrideforget(orig, ui, repo, *pats, **opts): | 962 def overrideforget(orig, ui, repo, *pats, **opts): |
950 installnormalfilesmatchfn(repo[None].manifest()) | 963 installnormalfilesmatchfn(repo[None].manifest()) |
951 result = orig(ui, repo, *pats, **opts) | 964 result = orig(ui, repo, *pats, **opts) |
952 restorematchfn() | 965 restorematchfn() |
953 m = scmutil.match(repo[None], pats, opts) | 966 m = composelargefilematcher(scmutil.match(repo[None], pats, opts), |
967 repo[None].manifest()) | |
954 | 968 |
955 try: | 969 try: |
956 repo.lfstatus = True | 970 repo.lfstatus = True |
957 s = repo.status(match=m, clean=True) | 971 s = repo.status(match=m, clean=True) |
958 finally: | 972 finally: |