changeset 873:93ea115027fc

showrecord: Don't show empty records when filtering.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 15 Jun 2017 07:30:44 -0700
parents 3004ab31bb46
children f4608e2e80ce
files piecrust/commands/builtin/baking.py
diffstat 1 files changed, 27 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/commands/builtin/baking.py	Tue Jun 13 22:30:45 2017 -0700
+++ b/piecrust/commands/builtin/baking.py	Thu Jun 15 07:30:44 2017 -0700
@@ -205,34 +205,36 @@
                                          records._record_version))
         logger.info("")
 
-        for rec in records.records:
-            if ctx.args.fails and rec.success:
-                continue
+        if not ctx.args.show_stats:
+            for rec in records.records:
+                if ctx.args.fails and rec.success:
+                    continue
 
-            ppname = rec.name[rec.name.index('@') + 1:]
-            if ppname not in pipelines:
-                continue
-
-            entries_to_show = []
-
-            for e in rec.getEntries():
-                if ctx.args.fails and e.success:
+                ppname = rec.name[rec.name.index('@') + 1:]
+                if ppname not in pipelines:
                     continue
-                if in_pattern and not fnmatch.fnmatch(e.item_spec, in_pattern):
-                    continue
-                if out_pattern and not any(
-                        [fnmatch.fnmatch(op, out_pattern)
-                         for op in e.getAllOutputPaths()]):
-                    continue
-                entries_to_show.append(e)
+
+                entries_to_show = []
 
-            if entries_to_show:
-                logger.info("Record: %s" % rec.name)
-                logger.info("Status: %s" % ('SUCCESS' if rec.success
-                                            else 'FAILURE'))
-                for e in entries_to_show:
-                    _print_record_entry(e)
-                logger.info("")
+                for e in rec.getEntries():
+                    if ctx.args.fails and e.success:
+                        continue
+                    if in_pattern and not fnmatch.fnmatch(e.item_spec,
+                                                          in_pattern):
+                        continue
+                    if out_pattern and not any(
+                            [fnmatch.fnmatch(op, out_pattern)
+                             for op in e.getAllOutputPaths()]):
+                        continue
+                    entries_to_show.append(e)
+
+                if entries_to_show:
+                    logger.info("Record: %s" % rec.name)
+                    logger.info("Status: %s" % ('SUCCESS' if rec.success
+                                                else 'FAILURE'))
+                    for e in entries_to_show:
+                        _print_record_entry(e)
+                    logger.info("")
 
         stats = records.stats
         if ctx.args.show_stats: