New command "kwfiles" prints files configured for expansion
authorChristian Ebert <blacktrash@gmx.net>
Thu, 20 Sep 2007 19:29:11 +0100
changeset 246 d232d7082991
parent 245 b0316be232da
child 247 fc091591de7e
New command "kwfiles" prints files configured for expansion
hgkw/keyword.py
--- a/hgkw/keyword.py	Thu Sep 20 18:13:53 2007 +0100
+++ b/hgkw/keyword.py	Thu Sep 20 19:29:11 2007 +0100
@@ -316,7 +316,6 @@
     if candidates:
         return [f for f in candidates if kwfmatcher(f)
                 and f in files and not man.linkf(f)]
-    # kwexpand w/o args on all files in manifest
     return [f for f in files if kwfmatcher(f) and not man.linkf(f)]
 
 def _overwrite(ui, repo, files, expand):
@@ -365,6 +364,18 @@
     # 4th argument sets expansion to True
     _overwrite(ui, repo, args, True)
 
+def files(ui, repo):
+    '''print files currently configured for keyword expansion
+
+    crosscheck which files are matched by [keyword] config patterns
+    '''
+    kwfmatcher = _keywordmatcher(ui, repo)
+    if kwfmatcher is not None:
+        ctx = repo.changectx()
+        files = _weedcandidates(ctx.manifest(), kwfmatcher, None)
+        files.sort()
+        ui.write('\n'.join(files) + '\n')
+
 def demo(ui, repo, *args, **opts):
     '''print [keywordmaps] configuration and an expansion example
 
@@ -526,6 +537,7 @@
          [('d', 'default', None, _('show default keyword template maps')),
           ('f', 'rcfile', [], _('read maps from RCFILE'))],
          _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP ...]')),
+    'kwfiles': (files, [], _('hg kwfiles')),
     'kwshrink': (shrink, [], _('hg kwshrink [NAME] ...')),
     'kwexpand': (expand, [], _('hg kwexpand [NAME] ...')),
 }