chiark / gitweb /
Make sure that the output of "stg status" is sorted
authorKarl Hasselström <kha@treskal.com>
Sun, 23 Sep 2007 11:42:22 +0000 (13:42 +0200)
committerKarl Hasselström <kha@treskal.com>
Sun, 23 Sep 2007 22:54:06 +0000 (00:54 +0200)
This simplifies testing, but also makes it easier for the user to find
specific files.

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/commands/status.py

index bbfb5df843d82cf503ef61c7f451a2bc9e1292d7..b2835abf463e2a40051712fe2658a743ab29c709 100644 (file)
@@ -91,12 +91,15 @@ def status(files = None, modified = False, new = False, deleted = False,
             filestat.append('?')
         cache_files = [x for x in cache_files if x[0] in filestat]
 
-    for fs in cache_files:
-        assert files == None or fs[1] in files
-        if not filtered:
-            out.stdout('%s %s' % (fs[0], fs[1]))
+    output = []
+    for st, fn in cache_files:
+        assert files == None or fn in files
+        if filtered:
+            output.append(fn)
         else:
-            out.stdout('%s' % fs[1])
+            output.append('%s %s' % (st, fn))
+    for o in sorted(output):
+        out.stdout(o)
 
 def func(parser, options, args):
     """Show the tree status