hgkw/keyword.py
changeset 254 474eccf2964f
parent 253 22e08d0f25dc
child 255 c4f37735be9b
equal deleted inserted replaced
253:22e08d0f25dc 254:474eccf2964f
   170         kwmaps = self.ui.configitems('keywordmaps')
   170         kwmaps = self.ui.configitems('keywordmaps')
   171         if kwmaps: # override default templates
   171         if kwmaps: # override default templates
   172             kwmaps = [(k, templater.parsestring(v, quoted=False))
   172             kwmaps = [(k, templater.parsestring(v, quoted=False))
   173                       for (k, v) in kwmaps]
   173                       for (k, v) in kwmaps]
   174             self.templates = dict(kwmaps)
   174             self.templates = dict(kwmaps)
   175         escaped = [re.escape(k) for k in self.templates.keys()]
   175         escaped = map(re.escape, self.templates.keys())
   176         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   176         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   177         self.re_kw = re.compile(kwpat)
   177         self.re_kw = re.compile(kwpat)
   178         if self.t:
   178         if self.t:
   179             templater.common_filters['utcdate'] = utcdate
   179             templater.common_filters['utcdate'] = utcdate
   180             self.t = self._changeset_templater()
   180             self.t = self._changeset_templater()