# HG changeset patch # User Christian Ebert # Date 1243372178 -7200 # Node ID c6483eec6092414bac04f916706f572ed2305ec0 # Parent c88c8d59979f921b1ef358ead4d0ff896327d137 keyword: rename matcher() to match() mimicking changes in main diff -r c88c8d59979f -r c6483eec6092 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