hgkw/keyword.py
changeset 242 71056c5042de
parent 240 fb234089cc4c
child 243 bbd5af3ec247
equal deleted inserted replaced
241:e0a846f9f095 242:71056c5042de
   253         expand = self.t is not None
   253         expand = self.t is not None
   254         action = ('shrinking', 'expanding')[expand]
   254         action = ('shrinking', 'expanding')[expand]
   255         notify = (self.ui.note, self.ui.debug)[commit]
   255         notify = (self.ui.note, self.ui.debug)[commit]
   256         overwritten = []
   256         overwritten = []
   257         for f in candidates:
   257         for f in candidates:
   258             fp = self.repo.file(f, kwexp=expand, kwcnt=True)
   258             fp = self.repo.file(f, kwexp=expand, kwcnt=True, kwmatch=True)
   259             data, kwfound = fp.read(man[f])
   259             data, kwfound = fp.read(man[f])
   260             if kwfound:
   260             if kwfound:
   261                 notify(_('overwriting %s %s keywords\n') % (f, action))
   261                 notify(_('overwriting %s %s keywords\n') % (f, action))
   262                 self._wwrite(f, data, man)
   262                 self._wwrite(f, data, man)
   263                 overwritten.append(f)
   263                 overwritten.append(f)
   461     kwfmatcher = _keywordmatcher(ui, repo)
   461     kwfmatcher = _keywordmatcher(ui, repo)
   462     if kwfmatcher is None:
   462     if kwfmatcher is None:
   463         return
   463         return
   464 
   464 
   465     class kwrepo(repo.__class__):
   465     class kwrepo(repo.__class__):
   466         def file(self, f, kwexp=True, kwcnt=False):
   466         def file(self, f, kwexp=True, kwcnt=False, kwmatch=False):
   467             if f[0] == '/':
   467             if f[0] == '/':
   468                 f = f[1:]
   468                 f = f[1:]
   469             if kwfmatcher(f):
   469             if kwmatch or kwfmatcher(f):
   470                 kwt = kwtemplater(ui, self, kwexp, path=f)
   470                 kwt = kwtemplater(ui, self, kwexp, path=f)
   471                 return kwfilelog(self.sopener, f, kwt, kwcnt)
   471                 return kwfilelog(self.sopener, f, kwt, kwcnt)
   472             return filelog.filelog(self.sopener, f)
   472             return filelog.filelog(self.sopener, f)
   473 
   473 
   474         def _commit(self, files, text, user, date, match, force, lock, wlock,
   474         def _commit(self, files, text, user, date, match, force, lock, wlock,