--- a/hgkw/keyword.py Tue May 26 18:24:06 2009 +0200
+++ b/hgkw/keyword.py Wed May 27 20:34:38 2009 +0200
@@ -127,8 +127,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')
@@ -157,7 +157,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
@@ -166,7 +166,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.'''
@@ -206,13 +206,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)
@@ -255,8 +255,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'))
@@ -499,14 +499,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