Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 25470:378a8e700e02
largefiles: use the optional badfn argument when building a matcher
The monkey patching in cat() can't be fixed, because it still delegates to the
original bad(). Overriding commands.cat() should go away in favor overriding
cmdutil.cat() anyway, and that matcher can be wrapped with matchmod.badmatch().
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 05 Jun 2015 22:53:15 -0400 |
parents | ab618e52788a |
children | ba8089433090 |
comparison
equal
deleted
inserted
replaced
25469:cc3d94e5994e | 25470:378a8e700e02 |
---|---|
239 link(storepath(repo, hash), path) | 239 link(storepath(repo, hash), path) |
240 | 240 |
241 def getstandinmatcher(repo, rmatcher=None): | 241 def getstandinmatcher(repo, rmatcher=None): |
242 '''Return a match object that applies rmatcher to the standin directory''' | 242 '''Return a match object that applies rmatcher to the standin directory''' |
243 standindir = repo.wjoin(shortname) | 243 standindir = repo.wjoin(shortname) |
244 | |
245 # no warnings about missing files or directories | |
246 badfn = lambda f, msg: None | |
247 | |
244 if rmatcher and not rmatcher.always(): | 248 if rmatcher and not rmatcher.always(): |
245 pats = [os.path.join(standindir, pat) for pat in rmatcher.files()] | 249 pats = [os.path.join(standindir, pat) for pat in rmatcher.files()] |
246 match = scmutil.match(repo[None], pats) | 250 match = scmutil.match(repo[None], pats, badfn=badfn) |
247 # if pats is empty, it would incorrectly always match, so clear _always | 251 # if pats is empty, it would incorrectly always match, so clear _always |
248 match._always = False | 252 match._always = False |
249 else: | 253 else: |
250 # no patterns: relative to repo root | 254 # no patterns: relative to repo root |
251 match = scmutil.match(repo[None], [standindir]) | 255 match = scmutil.match(repo[None], [standindir], badfn=badfn) |
252 # no warnings about missing files or directories | |
253 match.bad = lambda f, msg: None | |
254 return match | 256 return match |
255 | 257 |
256 def composestandinmatcher(repo, rmatcher): | 258 def composestandinmatcher(repo, rmatcher): |
257 '''Return a matcher that accepts standins corresponding to the | 259 '''Return a matcher that accepts standins corresponding to the |
258 files accepted by rmatcher. Pass the list of files in the matcher | 260 files accepted by rmatcher. Pass the list of files in the matcher |