# HG changeset patch # User Christian Ebert # Date 1191705100 -7200 # Node ID fc7f60b109b6377aa4b393b7c8c86a36d13fbf22 # Parent 397a5957cc48017043ce9210e3bdb561a60a2942 kwfiles notifies if there are no files configured for expansion diff -r 397a5957cc48 -r fc7f60b109b6 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