hgkw/keyword.py
changeset 233 e60fdc1990e3
parent 232 030712a46eb9
child 234 6f1ed470541c
equal deleted inserted replaced
232:030712a46eb9 233:e60fdc1990e3
   173             for k, v in kwmaps:
   173             for k, v in kwmaps:
   174                 self.templates[k] = templater.parsestring(v, quoted=False)
   174                 self.templates[k] = templater.parsestring(v, quoted=False)
   175         escaped = [re.escape(k) for k in self.templates.keys()]
   175         escaped = [re.escape(k) for k in self.templates.keys()]
   176         rawkeyword = r'\$(%s)(: [^$\n\r]*? )??\$'
   176         rawkeyword = r'\$(%s)(: [^$\n\r]*? )??\$'
   177         self.re_kw = re.compile(rawkeyword % '|'.join(escaped))
   177         self.re_kw = re.compile(rawkeyword % '|'.join(escaped))
   178 
       
   179         if self.t:
   178         if self.t:
   180             templater.common_filters['utcdate'] = utcdate
   179             templater.common_filters['utcdate'] = utcdate
   181             try:
   180             self.t = self._changeset_templater()
   182                 self.t = cmdutil.changeset_templater(self.ui, self.repo,
   181 
   183                                                      False, '', False)
   182     def _changeset_templater(self):
   184             except TypeError:
   183         '''Backwards compatible cmdutil.changeset_templater.'''
   185                 # depending on hg rev changeset_templater has extra "brinfo" arg
   184         try:
   186                 self.t = cmdutil.changeset_templater(self.ui, self.repo,
   185             return cmdutil.changeset_templater(self.ui, self.repo,
   187                                                      False, None, '', False)
   186                                                False, '', False)
       
   187         except TypeError:
       
   188             # depending on hg rev changeset_templater has extra "brinfo" arg
       
   189             return cmdutil.changeset_templater(self.ui, self.repo,
       
   190                                                False, None, '', False)
   188 
   191 
   189     def _ctxnode(self, node):
   192     def _ctxnode(self, node):
   190         '''Obtains missing node from file context.'''
   193         '''Obtains missing node from file context.'''
   191         if not self.node:
   194         if not self.node:
   192             c = context.filectx(self.repo, self.path, fileid=node)
   195             c = context.filectx(self.repo, self.path, fileid=node)