From 57ad245e927b1e5a9b230de3605431a041bb192e Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Mon, 3 Apr 2006 13:42:14 -0400 Subject: Added reply handling to comments --- becommands/comment.py | 12 +++++++++--- becommands/show.py | 13 ++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'becommands') diff --git a/becommands/comment.py b/becommands/comment.py index 37fd37d..4f0bf3b 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -46,7 +46,7 @@ def execute(args): options, args = get_parser().parse_args(args) if len(args) < 1: raise cmdutil.UsageError() - bug = cmdutil.get_bug(args[0]) + bug, parent_comment = cmdutil.get_bug_and_comment(args[0]) if len(args) == 1: try: body = utility.editor_string() @@ -61,15 +61,21 @@ def execute(args): body+='\n' comment = bugdir.new_comment(bug, body) + if parent_comment is not None: + comment.in_reply_to = parent_comment.uuid comment.save() def get_parser(): - parser = cmdutil.CmdOptionParser("be comment BUG-ID COMMENT") + parser = cmdutil.CmdOptionParser("be comment ID COMMENT") return parser longhelp=""" -Add a comment to a bug. +To add a comment to a bug, use the bug ID as the argument. To reply to another +comment, specify the comment name (as shown in "be show" output). + +$EDITOR is used to launch an editor. If unspecified, no comment will be +created.) """ def help(): diff --git a/becommands/show.py b/becommands/show.py index 9e60586..db3bb90 100644 --- a/becommands/show.py +++ b/becommands/show.py @@ -30,8 +30,11 @@ def execute(args): time_str = "%s (%s)" % (utility.handy_time(bug.time), utility.time_to_str(bug.time)) print "Created: %s" % time_str - for comment in bug.list_comments(): - print "--------- Comment ---------" - print "From: %s" % comment.From - print "Date: %s\n" % utility.time_to_str(comment.date) - print comment.body.rstrip('\n') + 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) -- cgit