(0.9.2compat) kwfiles print code similar to commands.status 0.9.2compat
authorChristian Ebert <blacktrash@gmx.net>
Wed, 14 Nov 2007 13:36:41 +0100
branch0.9.2compat
changeset 299 50bb27cfd926
parent 295 5b4039ca6867
child 303 46ccec2f325f
(0.9.2compat) kwfiles print code similar to commands.status
hgkw/keyword.py
--- a/hgkw/keyword.py	Sat Nov 10 14:33:15 2007 +0100
+++ b/hgkw/keyword.py	Wed Nov 14 13:36:41 2007 +0100
@@ -450,15 +450,19 @@
     cwd = pats and repo.getcwd() or ''
     allf = opts['all']
     ignore = opts['ignore']
-    flag = (allf or ui.verbose) and 1 or 0
-    if not ignore:
-        format = ('%s\n', 'K %s\n')[flag]
-        for k in kwfiles:
-            ui.write(format % _pathto(repo, k, cwd))
+    if ignore:
+        kwfstats = ()
+    else:
+        kwfstats = (('K', kwfiles),)
     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, i, cwd))
+        kwfstats += (('I', [f for f in files if f not in kwfiles]),)
+    for char, filenames in kwfstats:
+        if allf or ui.verbose:
+            format = '%s %%s\n' % char
+        else:
+            format = '%s\n'
+        for f in filenames:
+            ui.write(format % repo.pathto(f, cwd))
 
 def shrink(ui, repo, *pats, **opts):
     '''revert expanded keywords in working directory