hgkw/keyword.py
changeset 443 3b71ebfe45ac
parent 442 1bb9230b055d
child 446 1c3a9f84dbbc
equal deleted inserted replaced
442:1bb9230b055d 443:3b71ebfe45ac
   133                                     inc=kwtools['inc'], exc=kwtools['exc'])[1]
   133                                     inc=kwtools['inc'], exc=kwtools['exc'])[1]
   134         self.restrict = kwtools['hgcmd'] in restricted.split()
   134         self.restrict = kwtools['hgcmd'] in restricted.split()
   135 
   135 
   136         kwmaps = self.ui.configitems('keywordmaps')
   136         kwmaps = self.ui.configitems('keywordmaps')
   137         if kwmaps: # override default templates
   137         if kwmaps: # override default templates
   138             kwmaps = [(k, templater.parsestring(v, quoted=False))
   138             kwmaps = [(k, templater.parsestring(v, False))
   139                       for (k, v) in kwmaps]
   139                       for (k, v) in kwmaps]
   140             self.templates = dict(kwmaps)
   140             self.templates = dict(kwmaps)
   141         escaped = map(re.escape, self.templates.keys())
   141         escaped = map(re.escape, self.templates.keys())
   142         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   142         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   143         self.re_kw = re.compile(kwpat)
   143         self.re_kw = re.compile(kwpat)
   307     kwstatus = 'current'
   307     kwstatus = 'current'
   308     fn = 'demo.txt'
   308     fn = 'demo.txt'
   309     branchname = 'demobranch'
   309     branchname = 'demobranch'
   310     tmpdir = tempfile.mkdtemp('', 'kwdemo.')
   310     tmpdir = tempfile.mkdtemp('', 'kwdemo.')
   311     ui.note(_('creating temporary repo at %s\n') % tmpdir)
   311     ui.note(_('creating temporary repo at %s\n') % tmpdir)
   312     repo = localrepo.localrepository(ui, path=tmpdir, create=True)
   312     repo = localrepo.localrepository(ui, tmpdir, True)
   313     ui.setconfig('keyword', fn, '')
   313     ui.setconfig('keyword', fn, '')
   314     if args or opts.get('rcfile'):
   314     if args or opts.get('rcfile'):
   315         kwstatus = 'custom'
   315         kwstatus = 'custom'
   316     if opts.get('rcfile'):
   316     if opts.get('rcfile'):
   317         ui.readconfig(opts.get('rcfile'))
   317         ui.readconfig(opts.get('rcfile'))