[PATCH] keyword: rename matcher() to match() mimicking changes in main

Christian Ebert blacktrash at gmx.net
Tue May 26 16:10:21 CDT 2009


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1243372178 -7200
# Node ID 380852cc8fa82fb635730093785f166baca82071
# Parent  8e69a22f67927f66e6fe3f53d7f51d8d0acd5385
keyword: rename matcher() to match() mimicking changes in main

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -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


More information about the Mercurial-devel mailing list