comparison mercurial/context.py @ 25465:f472228a9e5e

context: add an optional constructor parameter for a match.bad() override Most matcher creation is done by way of a context.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 05 Jun 2015 19:01:04 -0400
parents a592a6a6f4fe
children 183965a00c76
comparison
equal deleted inserted replaced
25464:504a1f295677 25465:f472228a9e5e
253 253
254 def nullsub(self, path, pctx): 254 def nullsub(self, path, pctx):
255 return subrepo.nullsubrepo(self, path, pctx) 255 return subrepo.nullsubrepo(self, path, pctx)
256 256
257 def match(self, pats=[], include=None, exclude=None, default='glob', 257 def match(self, pats=[], include=None, exclude=None, default='glob',
258 listsubrepos=False): 258 listsubrepos=False, badfn=None):
259 r = self._repo 259 r = self._repo
260 return matchmod.match(r.root, r.getcwd(), pats, 260 return matchmod.match(r.root, r.getcwd(), pats,
261 include, exclude, default, 261 include, exclude, default,
262 auditor=r.auditor, ctx=self, 262 auditor=r.auditor, ctx=self,
263 listsubrepos=listsubrepos) 263 listsubrepos=listsubrepos, badfn=badfn)
264 264
265 def diff(self, ctx2=None, match=None, **opts): 265 def diff(self, ctx2=None, match=None, **opts):
266 """Returns a diff generator for the given contexts and matcher""" 266 """Returns a diff generator for the given contexts and matcher"""
267 if ctx2 is None: 267 if ctx2 is None:
268 ctx2 = self.p1() 268 ctx2 = self.p1()
1446 self._repo.dirstate.copy(source, dest) 1446 self._repo.dirstate.copy(source, dest)
1447 finally: 1447 finally:
1448 wlock.release() 1448 wlock.release()
1449 1449
1450 def match(self, pats=[], include=None, exclude=None, default='glob', 1450 def match(self, pats=[], include=None, exclude=None, default='glob',
1451 listsubrepos=False): 1451 listsubrepos=False, badfn=None):
1452 r = self._repo 1452 r = self._repo
1453 1453
1454 # Only a case insensitive filesystem needs magic to translate user input 1454 # Only a case insensitive filesystem needs magic to translate user input
1455 # to actual case in the filesystem. 1455 # to actual case in the filesystem.
1456 if not util.checkcase(r.root): 1456 if not util.checkcase(r.root):
1457 return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, 1457 return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include,
1458 exclude, default, r.auditor, self, 1458 exclude, default, r.auditor, self,
1459 listsubrepos=listsubrepos) 1459 listsubrepos=listsubrepos,
1460 badfn=badfn)
1460 return matchmod.match(r.root, r.getcwd(), pats, 1461 return matchmod.match(r.root, r.getcwd(), pats,
1461 include, exclude, default, 1462 include, exclude, default,
1462 auditor=r.auditor, ctx=self, 1463 auditor=r.auditor, ctx=self,
1463 listsubrepos=listsubrepos) 1464 listsubrepos=listsubrepos, badfn=badfn)
1464 1465
1465 def _filtersuspectsymlink(self, files): 1466 def _filtersuspectsymlink(self, files):
1466 if not files or self._repo.dirstate._checklink: 1467 if not files or self._repo.dirstate._checklink:
1467 return files 1468 return files
1468 1469