diff --git a/hgext/acl.py b/hgext/acl.py --- a/hgext/acl.py +++ b/hgext/acl.py @@ -46,7 +46,7 @@ # ** = user6 from mercurial.i18n import _ -from mercurial import util +from mercurial import util, match import getpass def buildmatch(ui, repo, user, key): @@ -60,8 +60,9 @@ def buildmatch(ui, repo, user, key): ui.debug(_('acl: %s enabled, %d entries for user %s\n') % (key, len(pats), user)) if pats: - return util.matcher(repo.root, names=pats)[1] - return util.never + return match.match(repo.root, '', pats, [], [], 'glob') + return match.never(repo.root, '') + def hook(ui, repo, hooktype, node=None, source=None, **kwargs): if hooktype != 'pretxnchangegroup': diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -81,7 +81,7 @@ like CVS' $Log$, are not supported. A ke ''' from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions -from mercurial import patch, localrepo, templater, templatefilters, util +from mercurial import patch, localrepo, templater, templatefilters, util, match from mercurial.hgweb import webcommands from mercurial.lock import release from mercurial.node import nullid, hex @@ -125,8 +125,8 @@ class kwtemplater(object): def __init__(self, ui, repo): self.ui = ui self.repo = repo - self.matcher = util.matcher(repo.root, - inc=kwtools['inc'], exc=kwtools['exc'])[1] + self.matcher = match.match(repo.root, '', [], + kwtools['inc'], kwtools['exc'], 'glob') self.restrict = kwtools['hgcmd'] in restricted.split() kwmaps = self.ui.configitems('keywordmaps') diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -7,7 +7,7 @@ from node import short from i18n import _ -import util, simplemerge +import util, simplemerge, match import os, tempfile, re, filecmp def _toolstr(ui, tool, part, default=""): @@ -55,7 +55,7 @@ def _picktool(repo, ui, path, binary, sy # then patterns for pat, tool in ui.configitems("merge-patterns"): - mf = util.matcher(repo.root, "", [pat], [], [])[1] + mf = match.match(repo.root, '', [pat], [], [], 'glob') if mf(path) and check(tool, pat, symlink, False): toolpath = _findtool(ui, tool) return (tool, '"' + toolpath + '"') diff --git a/mercurial/ignore.py b/mercurial/ignore.py --- a/mercurial/ignore.py +++ b/mercurial/ignore.py @@ -6,7 +6,7 @@ # GNU General Public License version 2, incorporated herein by reference. from i18n import _ -import util +import util, match import re _commentre = None @@ -80,12 +80,13 @@ def ignore(root, files, warn): return util.never try: - files, ignorefunc, anypats = ( - util.matcher(root, inc=allpats, src='.hgignore')) + ignorefunc = match.match(root, '', [], allpats, [], 'glob') except util.Abort: # Re-raise an exception where the src is the right file for f, patlist in pats.iteritems(): - files, ignorefunc, anypats = ( - util.matcher(root, inc=patlist, src=f)) + try: + match.match(root, '', [], patlist, [], 'glob') + except util.Abort, inst: + raise util.Abort('%s: %s' % (f, inst[0])) return ignorefunc diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -528,7 +528,7 @@ class localrepository(repo.repository): for pat, cmd in self.ui.configitems(filter): if cmd == '!': continue - mf = util.matcher(self.root, "", [pat], [], [])[1] + mf = match_.match(self.root, '', [pat], [], [], 'glob') fn = None params = cmd for name, filterfn in self._datafilters.iteritems(): diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -50,5 +50,5 @@ class exact(_match): class match(_match): def __init__(self, root, cwd, patterns, include, exclude, default): f, mf, ap = util.matcher(root, cwd, patterns, include, exclude, - None, default) + default) _match.__init__(self, root, cwd, f, mf, ap) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -342,7 +342,7 @@ def canonpath(root, cwd, myname): raise Abort('%s not under root' % myname) -def matcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None, dflt_pat='glob'): +def matcher(canonroot, cwd='', names=[], inc=[], exc=[], dflt_pat='glob'): """build a function to match a set of file patterns arguments: @@ -352,7 +352,6 @@ def matcher(canonroot, cwd='', names=[], inc - patterns to include exc - patterns to exclude dflt_pat - if a pattern in names has no explicit type, assume this one - src - where these patterns came from (e.g. .hgignore) a pattern is one of: 'glob:' - a glob relative to cwd @@ -422,11 +421,7 @@ def matcher(canonroot, cwd='', names=[], try: re.compile('(?:%s)' % regex(k, p, tail)) except re.error: - if src: - raise Abort("%s: invalid pattern (%s): %s" % - (src, k, p)) - else: - raise Abort("invalid pattern (%s): %s" % (k, p)) + raise Abort("invalid pattern (%s): %s" % (k, p)) raise Abort("invalid pattern") def globprefix(pat):