kwfiles: change option "ignored" to "ignore", add option "untracked"
authorChristian Ebert <blacktrash@gmx.net>
Tue, 16 Oct 2007 07:43:55 +0200
changeset 270 371ce7fe5f13
parent 269 b5b64c9da876
child 271 35f43e2ce5b6
kwfiles: change option "ignored" to "ignore", add option "untracked" "ignore" like corresponding config value. "untracked" allows quick check if a new file that has not been added yet would be target for expansion. Update help accordingly.
hgkw/keyword.py
--- a/hgkw/keyword.py	Mon Oct 15 11:01:00 2007 +0200
+++ b/hgkw/keyword.py	Tue Oct 16 07:43:55 2007 +0200
@@ -358,24 +358,28 @@
 def files(ui, repo, *pats, **opts):
     '''print files currently configured for keyword expansion
 
-    Crosscheck which files in working directory are target of expansion,
-    that is, files matched by [keyword] config patterns but not symlinks.
+    Crosscheck which files in working directory are potential targets for
+    keyword expansion.
+    That is, files matched by [keyword] config patterns but not symlinks.
     '''
     files, match, anypats = cmdutil.matchpats(repo, pats, opts)
     status = repo.status(files=files, match=match, list_clean=True)
     modified, added, removed, deleted, unknown, ignored, clean = status
-    files = modified + added + clean
+    if opts['untracked']:
+        files = modified + added + unknown + clean
+    else:
+        files = modified + added + clean
     files.sort()
     kwfiles = _weedfiles(ui, repo, files)
     cwd = pats and repo.getcwd() or ''
     allf = opts['all']
-    ignored = opts['ignored']
+    ignore = opts['ignore']
     flag = (allf or ui.verbose) and 1 or 0
-    if not ignored:
+    if not ignore:
         format = ('%s\n', 'K %s\n')[flag]
         for k in kwfiles:
             ui.write(format % _pathto(repo, cwd, k))
-    if allf or ignored:
+    if allf or ignore:
         format = ('%s\n', 'I %s\n')[flag]
         for i in [f for f in files if f not in kwfiles]:
             ui.write(format % _pathto(repo, cwd, i))
@@ -552,8 +556,9 @@
          _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP ...]')),
     'kwfiles':
         (files,
-         [('i', 'ignored', None, _('show files ignored by [keyword] patterns')),
-          ('a', 'all', None, _('show keyword status flags of all files')),
+         [('a', 'all', None, _('show keyword status flags of all files')),
+          ('i', 'ignore', None, _('show files excluded from expansion')),
+          ('u', 'untracked', None, _('additionally show untracked files')),
          ] + commands.walkopts,
          _('hg kwfiles [OPTION]... [FILE]...')),
     'kwshrink': (shrink, commands.walkopts,