diff options
Diffstat (limited to 'becommands')
-rw-r--r-- | becommands/comment.py | 18 | ||||
-rw-r--r-- | becommands/diff.py | 7 |
2 files changed, 16 insertions, 9 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index 9408b09..fc30a26 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -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,7 +117,7 @@ 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: diff --git a/becommands/diff.py b/becommands/diff.py index 50dea7c..4b319ca 100644 --- a/becommands/diff.py +++ b/becommands/diff.py @@ -37,7 +37,6 @@ def execute(args, manipulate_encodings=True): Modified bug reports: a:cm: Bug A status: open -> closed - <BLANKLINE> """ parser = get_parser() options, args = parser.parse_args(args) @@ -54,7 +53,7 @@ def execute(args, manipulate_encodings=True): print "This directory is not revision-controlled." else: old_bd = bd.duplicate_bugdir(revision) - r,m,a = diff.diff(old_bd, bd) + r,m,a = diff.bug_diffs(old_bd, bd) optbugs = [] if options.all == True: @@ -69,7 +68,9 @@ def execute(args, manipulate_encodings=True): for bug in optbugs: print bug.uuid else : - print diff.diff_report((r,m,a), bd).encode(bd.encoding) + rep = diff.diff_report((r,m,a), old_bd, bd).encode(bd.encoding) + if len(rep) > 0: + print rep bd.remove_duplicate_bugdir() def get_parser(): |