becommands/show.py gives more specific bug information.
authorW. Trevor King <wking@drexel.edu>
Sat, 15 Nov 2008 21:17:05 +0000 (16:17 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 15 Nov 2008 21:17:05 +0000 (16:17 -0500)
becommands/show.py
libbe/cmdutil.py

index e75c1ac1a32b79ac61282d9763837e06d195a9ac..786ba294b20865e91a8ea5e4f2a37785d29f82a7 100644 (file)
@@ -26,12 +26,6 @@ def execute(args):
     bug_dir = cmdutil.bug_tree()
     bug = cmdutil.get_bug(args[0], bug_dir)
     print cmdutil.bug_summary(bug, list(bug_dir.list())).rstrip("\n")
-    if bug.time is None:
-        time_str = "(Unknown time)"
-    else:
-        time_str = "%s (%s)" % (utility.handy_time(bug.time), 
-                                utility.time_to_str(bug.time))
-    print "Created: %s" % time_str
     unique_name = cmdutil.unique_name(bug, bug_dir.list())
     comments = []
     name_map = {}
index 6fb915a5bcac47b53a4d0ff638a3cf6acea9beed..69cfe842f50e481e025a149038c28fa0ee07ec4d 100644 (file)
@@ -73,21 +73,27 @@ def get_bug(spec, bug_dir=None):
     return matches[0]
 
 def bug_summary(bug, bugs, no_target=False, shortlist=False):
-    target = bug.target
-    if target is None or no_target:
-        target = ""
-    else:
-        target = "  Target: %s" % target
-    if bug.assigned is None:
-        assigned = ""
-    else:
-        assigned = "  Assigned: %s" % bug.assigned
+    info = [("ID", bug.uuid),
+            ("Short name", unique_name(bug, bugs)),
+            ("Severity", bug.severity),
+            ("Status", bug.status),
+            ("Assigned", bug.assigned),
+            ("Target", bug.target),
+            ("Creator", bug.creator),
+            ("Created", "%s (%s)" % (utility.handy_time(bug.time),utility.time_to_str(bug.time)))]
+    newinfo = []
+    for k,v in info:
+        if v == None:
+            newinfo.append((k,""))
+        else:
+            newinfo.append((k,v))
+    info = newinfo
     if shortlist == False:
-       return "  ID: %s\n  Severity: %s\n%s%s\n  Creator: %s \n%s\n" % \
-            (unique_name(bug, bugs), bug.severity, assigned, target,
-             bug.creator, bug.summary)
+        longest_key_len = max([len(k) for k,v in info])
+        infolines = ["  %*s : %s\n" % (longest_key_len,k,v) for k,v in info]
+        return "".join(infolines) + "%s\n" % bug.summary
     else:
-       return "%4s: %s\n" % (unique_name(bug, bugs), bug.summary)
+       return "%s: %s\n" % (unique_name(bug, bugs), bug.summary)
 
 def iter_commands():
     for name, module in plugin.iter_plugins("becommands"):