aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/show.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/show.py')
-rw-r--r--becommands/show.py45
1 files changed, 24 insertions, 21 deletions
diff --git a/becommands/show.py b/becommands/show.py
index 8e83a1f..abec813 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -15,33 +15,36 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Show a particular bug"""
-from libbe import bugdir, cmdutil, utility
-import os
+from libbe import cmdutil, bugdir
+__desc__ = __doc__
def execute(args):
+ """
+ >>> import os
+ >>> bd = bugdir.simple_bug_dir()
+ >>> os.chdir(bd.root)
+ >>> execute (["a",])
+ ID : a
+ Short name : a
+ Severity : minor
+ Status : open
+ Assigned :
+ Target :
+ Creator : John Doe <jdoe@example.com>
+ Created : Wed, 31 Dec 1969 19:00 (Thu, 01 Jan 1970 00:00:00 +0000)
+ Bug A
+ <BLANKLINE>
+ """
options, args = get_parser().parse_args(args)
- if len(args) !=1:
+ if len(args) == 0:
raise cmdutil.UserError("Please specify a bug id.")
- 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 = {}
- for c_name, comment in cmdutil.iter_comment_name(bug, unique_name):
- name_map[comment.uuid] = c_name
- comments.append(comment)
- threaded = bugdir.thread_comments(comments)
- cmdutil.print_threaded_comments(threaded, name_map)
+ bd = bugdir.BugDir(from_disk=True)
+ for bugid in args:
+ bug = bd.bug_from_shortname(bugid)
+ print bug.string(show_comments=True)
def get_parser():
- parser = cmdutil.CmdOptionParser("be show bug-id")
+ parser = cmdutil.CmdOptionParser("be show BUG-ID [BUG-ID ...]")
return parser
longhelp="""