##// END OF EJS Templates
context: add a match builder method...
Matt Mackall -
r14669:2d2604ad default
parent child Browse files
Show More
@@ -8,6 +8,7 b''
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
@@ -208,6 +209,11 b' class changectx(object):'
208 def sub(self, path):
209 def sub(self, path):
209 return subrepo.subrepo(self, path)
210 return subrepo.subrepo(self, path)
210
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)
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:
@@ -563,9 +563,8 b' def match(repo, pats=[], opts={}, globbe'
563 pats = []
563 pats = []
564 if not globbed and default == 'relpath':
564 if not globbed and default == 'relpath':
565 pats = expandpats(pats or [])
565 pats = expandpats(pats or [])
566 m = matchmod.match(repo.root, repo.getcwd(), pats,
566 m = repo[None].match(pats, opts.get('include'), opts.get('exclude'),
567 opts.get('include'), opts.get('exclude'), default,
567 default)
568 auditor=repo.auditor)
569 def badfn(f, msg):
568 def badfn(f, msg):
570 repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
569 repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
571 m.bad = badfn
570 m.bad = badfn
General Comments 0
You need to be logged in to leave comments. Login now