hgkw/keyword.py
changeset 524 8117a011d1bd
parent 523 062ce3b9c962
child 525 6028e8046c14
equal deleted inserted replaced
517:3fef0be9f550 524:8117a011d1bd
   137         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   137         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   138         self.re_kw = re.compile(kwpat)
   138         self.re_kw = re.compile(kwpat)
   139 
   139 
   140         templatefilters.filters['utcdate'] = utcdate
   140         templatefilters.filters['utcdate'] = utcdate
   141         self.ct = cmdutil.changeset_templater(self.ui, self.repo,
   141         self.ct = cmdutil.changeset_templater(self.ui, self.repo,
   142                                               False, '', False)
   142                                               False, None, '', False)
   143 
   143 
   144     def substitute(self, data, path, ctx, subfunc):
   144     def substitute(self, data, path, ctx, subfunc):
   145         '''Replaces keywords in data with expanded template.'''
   145         '''Replaces keywords in data with expanded template.'''
   146         def kwsub(mobj):
   146         def kwsub(mobj):
   147             kw = mobj.group(1)
   147             kw = mobj.group(1)
   483                 return n
   483                 return n
   484             finally:
   484             finally:
   485                 del wlock, lock
   485                 del wlock, lock
   486 
   486 
   487     # monkeypatches
   487     # monkeypatches
   488     def kwpatchfile_init(orig, self, ui, fname, missing=False):
   488     def kwpatchfile_init(orig, self, ui, fname, opener, missing=False):
   489         '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
   489         '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
   490         rejects or conflicts due to expanded keywords in working dir.'''
   490         rejects or conflicts due to expanded keywords in working dir.'''
   491         orig(self, ui, fname, missing)
   491         orig(self, ui, fname, opener, missing)
   492         # shrink keywords read from working dir
   492         # shrink keywords read from working dir
   493         self.lines = kwt.shrinklines(self.fname, self.lines)
   493         self.lines = kwt.shrinklines(self.fname, self.lines)
   494 
   494 
   495     def kw_diff(orig, repo, node1=None, node2=None, match=None, changes=None,
   495     def kw_diff(orig, repo, node1=None, node2=None, match=None, changes=None,
   496                 opts=None):
   496                 opts=None):