Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 14669:2d2604adfdd6
context: add a match builder method
This is groundwork for matching against filesets in contexts
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:52:51 -0500 |
parents | f3a40fd7008c |
children | 1c151b963254 |
comparison
equal
deleted
inserted
replaced
14668:2d6f1b2c6a82 | 14669:2d2604adfdd6 |
---|---|
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from node import nullid, nullrev, short, hex | 8 from node import nullid, nullrev, short, hex |
9 from i18n import _ | 9 from i18n import _ |
10 import ancestor, bdiff, error, util, scmutil, subrepo, patch, encoding | 10 import ancestor, bdiff, error, util, scmutil, subrepo, patch, encoding |
11 import match as matchmod | |
11 import os, errno, stat | 12 import os, errno, stat |
12 | 13 |
13 propertycache = util.propertycache | 14 propertycache = util.propertycache |
14 | 15 |
15 class changectx(object): | 16 class changectx(object): |
205 if match.bad(fn, _('no such file in rev %s') % self) and match(fn): | 206 if match.bad(fn, _('no such file in rev %s') % self) and match(fn): |
206 yield fn | 207 yield fn |
207 | 208 |
208 def sub(self, path): | 209 def sub(self, path): |
209 return subrepo.subrepo(self, path) | 210 return subrepo.subrepo(self, path) |
211 | |
212 def match(self, pats=[], include=None, exclude=None, default='glob'): | |
213 r = self._repo | |
214 return matchmod.match(r.root, r.getcwd(), pats, | |
215 include, exclude, default, auditor=r.auditor) | |
210 | 216 |
211 def diff(self, ctx2=None, match=None, **opts): | 217 def diff(self, ctx2=None, match=None, **opts): |
212 """Returns a diff generator for the given contexts and matcher""" | 218 """Returns a diff generator for the given contexts and matcher""" |
213 if ctx2 is None: | 219 if ctx2 is None: |
214 ctx2 = self.p1() | 220 ctx2 = self.p1() |