aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/comment.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-27 08:12:16 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-27 08:12:16 -0400
commit675aa10516d1fe2a5f0502be5553e38169f444c0 (patch)
treecb19b2ee621cd1120ae9afdafe6f52ee70137a32 /becommands/comment.py
parent885b04b50ad3bbde81ec2eccfbfb2e516d0d3a80 (diff)
parent7f2ee356b76303edd01efad6bd049fbc7f01b5ff (diff)
downloadbugseverywhere-675aa10516d1fe2a5f0502be5553e38169f444c0.tar.gz
Merged "be subscribe" and be-handle-mail subscription support.
Also assorted other changes and fixes in the be.subscribe branch. Highlights: * Much more powerful libbe.diff with subclassable report generators. * "be diff" compares working copy with last commit by default. * comment reference text shown in "be comment" EDITOR footer * .revision_id() for all VCSs * meaningful comment comparison and stricter bug comparison * stricter .sync_with_disk interpretation. See BugDir.__doc__. * Comment.From and .time_string -> .author and .date, for better conformance with settings_object.setting_name_to_attr_name().
Diffstat (limited to 'becommands/comment.py')
-rw-r--r--becommands/comment.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/becommands/comment.py b/becommands/comment.py
index 9408b09..7bbee2c 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -38,7 +38,7 @@ def execute(args, manipulate_encodings=True):
>>> print comment.body
This is a comment about a
<BLANKLINE>
- >>> comment.From == bd.user_id
+ >>> comment.author == bd.user_id
True
>>> comment.time <= int(time.time())
True
@@ -68,10 +68,10 @@ def execute(args, manipulate_encodings=True):
raise cmdutil.UsageError("Please specify a bug or comment id.")
if len(args) > 2:
raise cmdutil.UsageError("Too many arguments.")
-
+
shortname = args[0]
if shortname.count(':') > 1:
- raise cmdutil.UserError("Invalid id '%s'." % shortname)
+ raise cmdutil.UserError("Invalid id '%s'." % shortname)
elif shortname.count(':') == 1:
# Split shortname generated by Comment.comment_shortnames()
bugname = shortname.split(':')[0]
@@ -79,7 +79,7 @@ def execute(args, manipulate_encodings=True):
else:
bugname = shortname
is_reply = False
-
+
bd = bugdir.BugDir(from_disk=True,
manipulate_encodings=manipulate_encodings)
bug = bd.bug_from_shortname(bugname)
@@ -89,10 +89,16 @@ def execute(args, manipulate_encodings=True):
bug_shortname=bugname)
else:
parent = bug.comment_root
-
+
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:
@@ -111,11 +117,11 @@ def execute(args, manipulate_encodings=True):
body = args[1]
if not body.endswith('\n'):
body+='\n'
-
+
if options.XML == False:
new = parent.new_reply(body=body)
if options.author != None:
- new.From = options.author
+ new.author = options.author
if options.alt_id != None:
new.alt_id = options.alt_id
if options.content_type != None: