keyword: rename matcher() to match() mimicking changes in main
authorChristian Ebert <blacktrash@gmx.net>
Tue, 26 May 2009 23:09:38 +0200
changeset 8638 c6483eec6092
parent 8637 c88c8d59979f
child 8639 1323dddf8078
keyword: rename matcher() to match() mimicking changes in main
hgext/keyword.py
--- a/hgext/keyword.py	Sun May 24 22:15:48 2009 +0200
+++ b/hgext/keyword.py	Tue May 26 23:09:38 2009 +0200
@@ -125,8 +125,8 @@
     def __init__(self, ui, repo):
         self.ui = ui
         self.repo = repo
-        self.matcher = match.match(repo.root, '', [],
-                                   kwtools['inc'], kwtools['exc'])
+        self.match = match.match(repo.root, '', [],
+                                 kwtools['inc'], kwtools['exc'])
         self.restrict = kwtools['hgcmd'] in restricted.split()
 
         kwmaps = self.ui.configitems('keywordmaps')
@@ -155,7 +155,7 @@
 
     def expand(self, path, node, data):
         '''Returns data with keywords expanded.'''
-        if not self.restrict and self.matcher(path) and not util.binary(data):
+        if not self.restrict and self.match(path) and not util.binary(data):
             ctx = self.repo.filectx(path, fileid=node).changectx()
             return self.substitute(data, path, ctx, self.re_kw.sub)
         return data
@@ -164,7 +164,7 @@
         '''Returns true if path matches [keyword] pattern
         and is not a symbolic link.
         Caveat: localrepository._link fails on Windows.'''
-        return self.matcher(path) and not 'l' in flagfunc(path)
+        return self.match(path) and not 'l' in flagfunc(path)
 
     def overwrite(self, node, expand, files):
         '''Overwrites selected files expanding/shrinking keywords.'''
@@ -204,13 +204,13 @@
 
     def shrink(self, fname, text):
         '''Returns text with all keyword substitutions removed.'''
-        if self.matcher(fname) and not util.binary(text):
+        if self.match(fname) and not util.binary(text):
             return self.shrinktext(text)
         return text
 
     def shrinklines(self, fname, lines):
         '''Returns lines with keyword substitutions removed.'''
-        if self.matcher(fname):
+        if self.match(fname):
             text = ''.join(lines)
             if not util.binary(text):
                 return self.shrinktext(text).splitlines(True)
@@ -253,8 +253,8 @@
     '''Bails out if [keyword] configuration is not active.
     Returns status of working directory.'''
     if kwt:
-        matcher = cmdutil.match(repo, pats, opts)
-        return repo.status(match=matcher, unknown=unknown, clean=True)
+        match = cmdutil.match(repo, pats, opts)
+        return repo.status(match=match, unknown=unknown, clean=True)
     if ui.configitems('keyword'):
         raise util.Abort(_('[keyword] patterns cannot match'))
     raise util.Abort(_('no [keyword] patterns configured'))
@@ -497,14 +497,14 @@
         '''Monkeypatch patch.diff to avoid expansion except when
         comparing against working dir.'''
         if node2 is not None:
-            kwt.matcher = util.never
+            kwt.match = util.never
         elif node1 is not None and node1 != repo['.'].node():
             kwt.restrict = True
         return orig(repo, node1, node2, match, changes, opts)
 
     def kwweb_skip(orig, web, req, tmpl):
         '''Wraps webcommands.x turning off keyword expansion.'''
-        kwt.matcher = util.never
+        kwt.match = util.never
         return orig(web, req, tmpl)
 
     repo.__class__ = kwrepo