##// END OF EJS Templates
keyword: rename matcher() to match() mimicking changes in main
Christian Ebert -
r8638:c6483eec default
parent child Browse files
Show More
@@ -125,8 +125,8 b' class kwtemplater(object):'
125 125 def __init__(self, ui, repo):
126 126 self.ui = ui
127 127 self.repo = repo
128 self.matcher = match.match(repo.root, '', [],
129 kwtools['inc'], kwtools['exc'])
128 self.match = match.match(repo.root, '', [],
129 kwtools['inc'], kwtools['exc'])
130 130 self.restrict = kwtools['hgcmd'] in restricted.split()
131 131
132 132 kwmaps = self.ui.configitems('keywordmaps')
@@ -155,7 +155,7 b' class kwtemplater(object):'
155 155
156 156 def expand(self, path, node, data):
157 157 '''Returns data with keywords expanded.'''
158 if not self.restrict and self.matcher(path) and not util.binary(data):
158 if not self.restrict and self.match(path) and not util.binary(data):
159 159 ctx = self.repo.filectx(path, fileid=node).changectx()
160 160 return self.substitute(data, path, ctx, self.re_kw.sub)
161 161 return data
@@ -164,7 +164,7 b' class kwtemplater(object):'
164 164 '''Returns true if path matches [keyword] pattern
165 165 and is not a symbolic link.
166 166 Caveat: localrepository._link fails on Windows.'''
167 return self.matcher(path) and not 'l' in flagfunc(path)
167 return self.match(path) and not 'l' in flagfunc(path)
168 168
169 169 def overwrite(self, node, expand, files):
170 170 '''Overwrites selected files expanding/shrinking keywords.'''
@@ -204,13 +204,13 b' class kwtemplater(object):'
204 204
205 205 def shrink(self, fname, text):
206 206 '''Returns text with all keyword substitutions removed.'''
207 if self.matcher(fname) and not util.binary(text):
207 if self.match(fname) and not util.binary(text):
208 208 return self.shrinktext(text)
209 209 return text
210 210
211 211 def shrinklines(self, fname, lines):
212 212 '''Returns lines with keyword substitutions removed.'''
213 if self.matcher(fname):
213 if self.match(fname):
214 214 text = ''.join(lines)
215 215 if not util.binary(text):
216 216 return self.shrinktext(text).splitlines(True)
@@ -253,8 +253,8 b' def _status(ui, repo, kwt, unknown, *pat'
253 253 '''Bails out if [keyword] configuration is not active.
254 254 Returns status of working directory.'''
255 255 if kwt:
256 matcher = cmdutil.match(repo, pats, opts)
257 return repo.status(match=matcher, unknown=unknown, clean=True)
256 match = cmdutil.match(repo, pats, opts)
257 return repo.status(match=match, unknown=unknown, clean=True)
258 258 if ui.configitems('keyword'):
259 259 raise util.Abort(_('[keyword] patterns cannot match'))
260 260 raise util.Abort(_('no [keyword] patterns configured'))
@@ -497,14 +497,14 b' def reposetup(ui, repo):'
497 497 '''Monkeypatch patch.diff to avoid expansion except when
498 498 comparing against working dir.'''
499 499 if node2 is not None:
500 kwt.matcher = util.never
500 kwt.match = util.never
501 501 elif node1 is not None and node1 != repo['.'].node():
502 502 kwt.restrict = True
503 503 return orig(repo, node1, node2, match, changes, opts)
504 504
505 505 def kwweb_skip(orig, web, req, tmpl):
506 506 '''Wraps webcommands.x turning off keyword expansion.'''
507 kwt.matcher = util.never
507 kwt.match = util.never
508 508 return orig(web, req, tmpl)
509 509
510 510 repo.__class__ = kwrepo
General Comments 0
You need to be logged in to leave comments. Login now