##// END OF EJS Templates
match: change all users of util.matcher to match.match
Matt Mackall -
r8566:744d6322 default
parent child Browse files
Show More
@@ -46,7 +46,7 b''
46 46 # ** = user6
47 47
48 48 from mercurial.i18n import _
49 from mercurial import util
49 from mercurial import util, match
50 50 import getpass
51 51
52 52 def buildmatch(ui, repo, user, key):
@@ -60,8 +60,9 b' def buildmatch(ui, repo, user, key):'
60 60 ui.debug(_('acl: %s enabled, %d entries for user %s\n') %
61 61 (key, len(pats), user))
62 62 if pats:
63 return util.matcher(repo.root, names=pats)[1]
64 return util.never
63 return match.match(repo.root, '', pats, [], [], 'glob')
64 return match.never(repo.root, '')
65
65 66
66 67 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
67 68 if hooktype != 'pretxnchangegroup':
@@ -81,7 +81,7 b" like CVS' $Log$, are not supported. A ke"
81 81 '''
82 82
83 83 from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions
84 from mercurial import patch, localrepo, templater, templatefilters, util
84 from mercurial import patch, localrepo, templater, templatefilters, util, match
85 85 from mercurial.hgweb import webcommands
86 86 from mercurial.lock import release
87 87 from mercurial.node import nullid, hex
@@ -125,8 +125,8 b' class kwtemplater(object):'
125 125 def __init__(self, ui, repo):
126 126 self.ui = ui
127 127 self.repo = repo
128 self.matcher = util.matcher(repo.root,
129 inc=kwtools['inc'], exc=kwtools['exc'])[1]
128 self.matcher = match.match(repo.root, '', [],
129 kwtools['inc'], kwtools['exc'], 'glob')
130 130 self.restrict = kwtools['hgcmd'] in restricted.split()
131 131
132 132 kwmaps = self.ui.configitems('keywordmaps')
@@ -7,7 +7,7 b''
7 7
8 8 from node import short
9 9 from i18n import _
10 import util, simplemerge
10 import util, simplemerge, match
11 11 import os, tempfile, re, filecmp
12 12
13 13 def _toolstr(ui, tool, part, default=""):
@@ -55,7 +55,7 b' def _picktool(repo, ui, path, binary, sy'
55 55
56 56 # then patterns
57 57 for pat, tool in ui.configitems("merge-patterns"):
58 mf = util.matcher(repo.root, "", [pat], [], [])[1]
58 mf = match.match(repo.root, '', [pat], [], [], 'glob')
59 59 if mf(path) and check(tool, pat, symlink, False):
60 60 toolpath = _findtool(ui, tool)
61 61 return (tool, '"' + toolpath + '"')
@@ -6,7 +6,7 b''
6 6 # GNU General Public License version 2, incorporated herein by reference.
7 7
8 8 from i18n import _
9 import util
9 import util, match
10 10 import re
11 11
12 12 _commentre = None
@@ -80,12 +80,13 b' def ignore(root, files, warn):'
80 80 return util.never
81 81
82 82 try:
83 files, ignorefunc, anypats = (
84 util.matcher(root, inc=allpats, src='.hgignore'))
83 ignorefunc = match.match(root, '', [], allpats, [], 'glob')
85 84 except util.Abort:
86 85 # Re-raise an exception where the src is the right file
87 86 for f, patlist in pats.iteritems():
88 files, ignorefunc, anypats = (
89 util.matcher(root, inc=patlist, src=f))
87 try:
88 match.match(root, '', [], patlist, [], 'glob')
89 except util.Abort, inst:
90 raise util.Abort('%s: %s' % (f, inst[0]))
90 91
91 92 return ignorefunc
@@ -528,7 +528,7 b' class localrepository(repo.repository):'
528 528 for pat, cmd in self.ui.configitems(filter):
529 529 if cmd == '!':
530 530 continue
531 mf = util.matcher(self.root, "", [pat], [], [])[1]
531 mf = match_.match(self.root, '', [pat], [], [], 'glob')
532 532 fn = None
533 533 params = cmd
534 534 for name, filterfn in self._datafilters.iteritems():
@@ -50,5 +50,5 b' class exact(_match):'
50 50 class match(_match):
51 51 def __init__(self, root, cwd, patterns, include, exclude, default):
52 52 f, mf, ap = util.matcher(root, cwd, patterns, include, exclude,
53 None, default)
53 default)
54 54 _match.__init__(self, root, cwd, f, mf, ap)
@@ -342,7 +342,7 b' def canonpath(root, cwd, myname):'
342 342
343 343 raise Abort('%s not under root' % myname)
344 344
345 def matcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None, dflt_pat='glob'):
345 def matcher(canonroot, cwd='', names=[], inc=[], exc=[], dflt_pat='glob'):
346 346 """build a function to match a set of file patterns
347 347
348 348 arguments:
@@ -352,7 +352,6 b" def matcher(canonroot, cwd='', names=[],"
352 352 inc - patterns to include
353 353 exc - patterns to exclude
354 354 dflt_pat - if a pattern in names has no explicit type, assume this one
355 src - where these patterns came from (e.g. .hgignore)
356 355
357 356 a pattern is one of:
358 357 'glob:<glob>' - a glob relative to cwd
@@ -422,11 +421,7 b" def matcher(canonroot, cwd='', names=[],"
422 421 try:
423 422 re.compile('(?:%s)' % regex(k, p, tail))
424 423 except re.error:
425 if src:
426 raise Abort("%s: invalid pattern (%s): %s" %
427 (src, k, p))
428 else:
429 raise Abort("invalid pattern (%s): %s" % (k, p))
424 raise Abort("invalid pattern (%s): %s" % (k, p))
430 425 raise Abort("invalid pattern")
431 426
432 427 def globprefix(pat):
General Comments 0
You need to be logged in to leave comments. Login now