[PATCH 1 of 2] keyword: lowercase status flags of untracked files in kwfile output

Christian Ebert blacktrash at gmx.net
Sun Jun 28 09:24:22 CDT 2009


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1246198287 -7200
# Node ID 68b957a86cd6b37380398d998e58c16e46c48468
# Parent  835a51e63c5b0e4eee4f95fcbbdaf4476629a621
keyword: lowercase status flags of untracked files in kwfile output

Document the flags and their meanings in the command help
(thanks to timeless for bringing this to my attention).

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -369,17 +369,27 @@
     for expansion.
 
     Use -u/--untracked to display untracked filenames as well.
+
+    With -a/--all and -v/--verbose the codes used to show the status
+    of files are:
+    K = keyword expansion candidate
+    k = keyword expansion candidate (untracked)
+    I = ignored
+    i = ignored (untracked)
     '''
     kwt = kwtools['templater']
     status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts)
     modified, added, removed, deleted, unknown, ignored, clean = status
-    files = sorted(modified + added + clean + unknown)
+    files = sorted(modified + added + clean)
     wctx = repo[None]
     kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
+    kwuntracked = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
     cwd = pats and repo.getcwd() or ''
-    kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
+    kwfstats = (not opts.get('ignore') and
+                (('K', kwfiles), ('k', kwuntracked),) or ())
     if opts.get('all') or opts.get('ignore'):
-        kwfstats += (('I', [f for f in files if f not in kwfiles]),)
+        kwfstats += (('I', [f for f in files if f not in kwfiles]),
+                     ('i', [f for f in unknown if f not in kwuntracked]),)
     for char, filenames in kwfstats:
         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
         for f in filenames:


More information about the Mercurial-devel mailing list