hgkw/keyword.py
branchkwmap-templates
changeset 104 e8b9a500f2e1
parent 103 e086f7eb0198
child 105 2a8b0a71c2ec
equal deleted inserted replaced
103:e086f7eb0198 104:e8b9a500f2e1
    91     provides keyword expansion function.
    91     provides keyword expansion function.
    92     '''
    92     '''
    93     def __init__(self, ui, repo):
    93     def __init__(self, ui, repo):
    94         self.ui = ui
    94         self.ui = ui
    95         self.repo = repo
    95         self.repo = repo
    96         templates = {}
    96         self.templates = (dict(self.ui.configitems('keywordmaps'))
    97         for k, v in self.ui.configitems('keywordmaps'):
    97                 or deftemplates)
    98             templates[k] = v
       
    99         self.templates = templates or deftemplates
       
   100         self.re_kw = re.compile(r'\$(%s)[^$]*?\$' %
    98         self.re_kw = re.compile(r'\$(%s)[^$]*?\$' %
   101                 '|'.join(re.escape(k) for k in self.templates.keys()))
    99                 '|'.join(re.escape(k) for k in self.templates.keys()))
   102         self.t = cmdutil.changeset_templater(self.ui, self.repo,
   100         self.t = cmdutil.changeset_templater(self.ui, self.repo,
   103                 False, '', False)
   101                 False, '', False)
   104 
   102