Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 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 | 378a8e700e02 |
comparison
equal
deleted
inserted
replaced
25292:31d543cd7062 | 25293:ab618e52788a |
---|---|
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 if rmatcher and rmatcher.files(): | 244 if rmatcher and not rmatcher.always(): |
245 pats = [os.path.join(standindir, pat) for pat in rmatcher.files()] | 245 pats = [os.path.join(standindir, pat) for pat in rmatcher.files()] |
246 match = scmutil.match(repo[None], pats) | |
247 # if pats is empty, it would incorrectly always match, so clear _always | |
248 match._always = False | |
246 else: | 249 else: |
247 # no patterns: relative to repo root | 250 # no patterns: relative to repo root |
248 pats = [standindir] | 251 match = scmutil.match(repo[None], [standindir]) |
249 # no warnings about missing files or directories | 252 # no warnings about missing files or directories |
250 match = scmutil.match(repo[None], pats) | |
251 match.bad = lambda f, msg: None | 253 match.bad = lambda f, msg: None |
252 return match | 254 return match |
253 | 255 |
254 def composestandinmatcher(repo, rmatcher): | 256 def composestandinmatcher(repo, rmatcher): |
255 '''Return a matcher that accepts standins corresponding to the | 257 '''Return a matcher that accepts standins corresponding to the |