hgkw/keyword.py
changeset 609 fefdf82b2320
parent 606 7f928c9d56d0
child 611 c50f56b5f4b8
equal deleted inserted replaced
608:6bad7f6bb4a5 609:fefdf82b2320
   122                                  kwtools['inc'], kwtools['exc'])
   122                                  kwtools['inc'], kwtools['exc'])
   123         self.restrict = kwtools['hgcmd'] in restricted.split()
   123         self.restrict = kwtools['hgcmd'] in restricted.split()
   124 
   124 
   125         kwmaps = self.ui.configitems('keywordmaps')
   125         kwmaps = self.ui.configitems('keywordmaps')
   126         if kwmaps: # override default templates
   126         if kwmaps: # override default templates
   127             kwmaps = [(k, templater.parsestring(v, False))
   127             self.templates = dict((k, templater.parsestring(v, False))
   128                       for (k, v) in kwmaps]
   128                                   for k, v in kwmaps)
   129             self.templates = dict(kwmaps)
       
   130         escaped = map(re.escape, self.templates.keys())
   129         escaped = map(re.escape, self.templates.keys())
   131         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   130         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   132         self.re_kw = re.compile(kwpat)
   131         self.re_kw = re.compile(kwpat)
   133 
   132 
   134         templatefilters.filters['utcdate'] = utcdate
   133         templatefilters.filters['utcdate'] = utcdate