hgkw/keyword.py
branch0.9.2compat
changeset 295 5b4039ca6867
parent 291 acd3fba02a50
child 299 50bb27cfd926
equal deleted inserted replaced
291:acd3fba02a50 295:5b4039ca6867
   237             return data
   237             return data
   238         return self.substitute(node, data, self.re_kw.sub)
   238         return self.substitute(node, data, self.re_kw.sub)
   239 
   239 
   240     def process(self, node, data):
   240     def process(self, node, data):
   241         '''Returns a tuple: data, count.
   241         '''Returns a tuple: data, count.
   242         Count is number of keywords/keyword substitutions.
   242         Count is number of keywords/keyword substitutions, indicates
       
   243         to caller whether to act on file containing data.
   243         Keywords in data are expanded, if templater was initialized.'''
   244         Keywords in data are expanded, if templater was initialized.'''
   244         if util.binary(data):
   245         if util.binary(data):
   245             return data, None
   246             return data, None
   246         if self.t:
   247         if self.t:
   247             return self.substitute(node, data, self.re_kw.subn)
   248             return self.substitute(node, data, self.re_kw.subn)
   302             t2 = super(kwfilelog, self).read(node)
   303             t2 = super(kwfilelog, self).read(node)
   303             return t2 != text
   304             return t2 != text
   304         return revlog.revlog.cmp(self, node, text)
   305         return revlog.revlog.cmp(self, node, text)
   305 
   306 
   306 def _status(ui, repo, *pats, **opts):
   307 def _status(ui, repo, *pats, **opts):
       
   308     '''Bails out if [keyword] configuration is not active.
       
   309     Returns status of working directory.'''
   307     if hasattr(ui, 'kwfmatcher'):
   310     if hasattr(ui, 'kwfmatcher'):
   308         files, match, anypats = cmdutil.matchpats(repo, pats, opts)
   311         files, match, anypats = cmdutil.matchpats(repo, pats, opts)
   309         return repo.status(files=files, match=match, list_clean=True)
   312         return repo.status(files=files, match=match, list_clean=True)
   310     if ui.configitems('keyword'):
   313     if ui.configitems('keyword'):
   311         raise util.Abort(_('[keyword] patterns cannot match'))
   314         raise util.Abort(_('[keyword] patterns cannot match'))