Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 19563:87503cd824fa
basectx: move match from changectx
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Mon, 05 Aug 2013 18:41:00 -0500 |
parents | 389d7767630d |
children | f0ed47b73d37 |
comparison
equal
deleted
inserted
replaced
19562:389d7767630d | 19563:87503cd824fa |
---|---|
119 except error.LookupError: | 119 except error.LookupError: |
120 return '' | 120 return '' |
121 | 121 |
122 def sub(self, path): | 122 def sub(self, path): |
123 return subrepo.subrepo(self, path) | 123 return subrepo.subrepo(self, path) |
124 | |
125 def match(self, pats=[], include=None, exclude=None, default='glob'): | |
126 r = self._repo | |
127 return matchmod.match(r.root, r.getcwd(), pats, | |
128 include, exclude, default, | |
129 auditor=r.auditor, ctx=self) | |
124 | 130 |
125 class changectx(basectx): | 131 class changectx(basectx): |
126 """A changecontext object makes access to data related to a particular | 132 """A changecontext object makes access to data related to a particular |
127 changeset convenient. It represents a read-only context already presnt in | 133 changeset convenient. It represents a read-only context already presnt in |
128 the repo.""" | 134 the repo.""" |
380 if fn in self._dirs: | 386 if fn in self._dirs: |
381 # specified pattern is a directory | 387 # specified pattern is a directory |
382 continue | 388 continue |
383 if match.bad(fn, _('no such file in rev %s') % self) and match(fn): | 389 if match.bad(fn, _('no such file in rev %s') % self) and match(fn): |
384 yield fn | 390 yield fn |
385 | |
386 def match(self, pats=[], include=None, exclude=None, default='glob'): | |
387 r = self._repo | |
388 return matchmod.match(r.root, r.getcwd(), pats, | |
389 include, exclude, default, | |
390 auditor=r.auditor, ctx=self) | |
391 | 391 |
392 def diff(self, ctx2=None, match=None, **opts): | 392 def diff(self, ctx2=None, match=None, **opts): |
393 """Returns a diff generator for the given contexts and matcher""" | 393 """Returns a diff generator for the given contexts and matcher""" |
394 if ctx2 is None: | 394 if ctx2 is None: |
395 ctx2 = self.p1() | 395 ctx2 = self.p1() |