hgkw/keyword.py
branchkwmap-templates
changeset 119 6b4cba263852
parent 118 d9cea05cb74c
child 120 4a8a861da58c
equal deleted inserted replaced
118:d9cea05cb74c 119:6b4cba263852
   103         return os.path.splitext(os.path.basename(__file__))[0]
   103         return os.path.splitext(os.path.basename(__file__))[0]
   104 
   104 
   105 def kwfmatches(ui, repo, files):
   105 def kwfmatches(ui, repo, files):
   106     '''Selects and weeds out candidates for keyword substitution
   106     '''Selects and weeds out candidates for keyword substitution
   107     by patterns configured in [keyword] section in hgrc.'''
   107     by patterns configured in [keyword] section in hgrc.'''
   108     inc, exc = [], []
   108     inc, exc = [], ['.hg*']
   109     for pat, opt in ui.configitems('keyword'):
   109     for pat, opt in ui.configitems('keyword'):
   110         if opt != 'ignore':
   110         if opt != 'ignore':
   111             inc.append(pat)
   111             inc.append(pat)
   112         else:
   112         else:
   113             exc.append(pat)
   113             exc.append(pat)
   114     if not inc:
   114     if not inc:
   115         return []
   115         return []
   116     kwfmatcher = util.matcher(repo.root, inc=inc, exc=['.hg*']+exc)[1]
   116     kwfmatcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
   117     return [f for f in files if kwfmatcher(f)]
   117     return [f for f in files if kwfmatcher(f)]
   118 
   118 
   119 class kwtemplater(object):
   119 class kwtemplater(object):
   120     '''
   120     '''
   121     Sets up keyword templates, corresponding keyword regex, and
   121     Sets up keyword templates, corresponding keyword regex, and