aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-22 08:44:38 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-22 08:44:38 -0400
commit8fd151cc1d4efad33341283c6509e28d8f139f50 (patch)
tree37f3dc40155f3d61dc30f2636214f0fa7ab4e5de /becommands
parent86d74730ded314d960e0465f2eb50e5fb66c4767 (diff)
downloadbugseverywhere-8fd151cc1d4efad33341283c6509e28d8f139f50.tar.gz
Show text of comment's reference in notes when spawning EDITOR.
Diffstat (limited to 'becommands')
-rw-r--r--becommands/comment.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/becommands/comment.py b/becommands/comment.py
index 5392286..dec4b92 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -80,7 +80,8 @@ def execute(args, test=False):
bugname = shortname
is_reply = False
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=not Test)
bug = bd.bug_from_shortname(bugname)
bug.load_comments(load_full=False)
if is_reply:
@@ -91,7 +92,13 @@ def execute(args, test=False):
if len(args) == 1: # try to launch an editor for comment-body entry
try:
- body = editor.editor_string("Please enter your comment above")
+ if parent == bug.comment_root:
+ parent_body = bug.summary+"\n"
+ else:
+ parent_body = parent.body
+ estr = "Please enter your comment above\n\n> %s\n" \
+ % ("\n> ".join(parent_body.splitlines()))
+ body = editor.editor_string(estr)
except editor.CantFindEditor, e:
raise cmdutil.UserError, "No comment supplied, and EDITOR not specified."
if body is None:
@@ -113,6 +120,10 @@ def execute(args, test=False):
if options.XML == False:
new = parent.new_reply(body=body)
+ if options.author != None:
+ new.From = options.author
+ if options.alt_id != None:
+ new.alt_id = options.alt_id
if options.content_type != None:
new.content_type = options.content_type
else: # import XML comment [list]
@@ -157,6 +168,10 @@ def execute(args, test=False):
def get_parser():
parser = cmdutil.CmdOptionParser("be comment ID [COMMENT]")
+ parser.add_option("-a", "--author", metavar="AUTHOR", dest="author",
+ help="Set the comment author", default=None)
+ parser.add_option("--alt-id", metavar="ID", dest="alt_id",
+ help="Set an alternate comment ID", default=None)
parser.add_option("-c", "--content-type", metavar="MIME", dest="content_type",
help="Set comment content-type (e.g. text/plain)", default=None)
parser.add_option("-x", "--xml", action="store_true", default=False,