--- a/hgkw/keyword.py Tue Jan 16 15:45:57 2007 +0100
+++ b/hgkw/keyword.py Tue Jan 16 19:17:54 2007 +0100
@@ -37,8 +37,10 @@
# hgext.keyword =
# filename patterns for expansion are configured in this section
+ # files matching patterns with value 'ignore' are ignored
[keyword]
- **.py = expand
+ **.py =
+ x* = ignore
...
# in case you prefer your own keyword maps over the cvs-like defaults:
[keywordmaps]
@@ -75,11 +77,12 @@
def kwfmatches(ui, repo, files):
'''Selects candidates for keyword substitution
configured in keyword section in hgrc.'''
- names = [pat for pat, opt in ui.configitems('keyword') if opt == 'expand']
- if not names:
- ui.warn(_('keyword: no filename patterns for expansion\n'))
+ inc = [pat for pat, opt in ui.configitems('keyword') if opt != 'ignore']
+ if not inc:
+ ui.warn(_('keyword: no filename globs for expansion\n'))
return []
- kwfmatcher = util.matcher(repo.root, cwd='', names=names, exc=['.hg*'])[1]
+ exc = [pat for pat, opt in ui.configitems('keyword') if opt == 'ignore']
+ kwfmatcher = util.matcher(repo.root, inc=inc, exc=['.hg*']+exc)[1]
return [f for f in files if kwfmatcher(f)]
@@ -95,6 +98,7 @@
self.re_kw = re.compile(r'\$(%s)[^$]*?\$' %
'|'.join(re.escape(k) for k in self.templates.keys()))
self.t = cmdutil.changeset_templater(ui, repo, False, '', False)
+
def expand(self, mobj, path, node):
'''Expands keyword with corresponding template.'''