kwfiles notifies if there are no files configured for expansion
authorChristian Ebert <blacktrash@gmx.net>
Sat, 06 Oct 2007 23:11:40 +0200
changeset 263 fc7f60b109b6
parent 262 397a5957cc48
child 264 7c637046c0e2
kwfiles notifies if there are no files configured for expansion
hgkw/keyword.py
--- a/hgkw/keyword.py	Sat Oct 06 19:55:30 2007 +0200
+++ b/hgkw/keyword.py	Sat Oct 06 23:11:40 2007 +0200
@@ -300,6 +300,8 @@
             return t2 != text
         return revlog.revlog.cmp(self, node, text)
 
+_nokwfiles = 'no files configured for keyword expansion'
+
 def _weedcandidates(ui, man, candidates):
     '''Weeds out files that do not match keyword file matcher,
     are not tracked, or are links.'''
@@ -312,7 +314,7 @@
 def _overwrite(ui, repo, files, expand):
     '''Expands/shrinks keywords in working directory.'''
     if not hasattr(ui, 'kwfmatcher'):
-        ui.warn(_('no files configured for keyword expansion\n'))
+        ui.warn(_('%s\n') % _nokwfiles)
         return
     bail_if_changed(repo)
     wlock = lock = None
@@ -356,14 +358,16 @@
     Crosscheck which files in working directory
     are matched by [keyword] config patterns.
     '''
-    if hasattr(ui, 'kwfmatcher'):
-        ctx = repo.workingctx()
-        man = ctx.manifest().copy()
-        for f in ctx.unknown():
-            del man[f]
-        files = _weedcandidates(ui, man, None)
-        files.sort()
-        ui.write('\n'.join(files) + '\n')
+    if not hasattr(ui, 'kwfmatcher'):
+        ui.note(_('%s\n') % _nokwfiles)
+        return
+    ctx = repo.workingctx()
+    man = ctx.manifest().copy()
+    for f in ctx.unknown():
+        del man[f]
+    files = _weedcandidates(ui, man, None)
+    files.sort()
+    ui.write('\n'.join(files) + '\n')
 
 def demo(ui, repo, *args, **opts):
     '''print [keywordmaps] configuration and an expansion example