From 05e0ff3ad3e39b30c366d4fdc11f90ea63daafd7 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 3 Dec 2008 23:01:29 -0500 Subject: Allow a separate description for git bz file Only use the commit body as the bug description when filing a new bug if no other description is specified; if another description is entered, use the commit body as the description for the attachment. --- TODO | 19 ------------------- git-bz | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index 575cc7c..010c89c 100644 --- a/TODO +++ b/TODO @@ -6,25 +6,6 @@ any intention of working on it myself. - Owen -Reconsider initial description for 'git bz file' - - Right now, if you have only a single patch, the initial description is the body - of the bug, and the attachment is done without any other comment. (But - still adds a comment to the bug because every attachment has a comment.) - - I often find I want to have a few sentences about why I'm making the - change different than the body of the commit (or ask someone to look at the - patch or something), so I've been adding extra text and a separator, - which leaves it unclear what the stuff after the separator is. - - Better way to handle it: - - - Start off the initial description empty in the editor - - If the user fills it in, use that as the initial description - and the body of the commit as the comment. - - If the user leaves it empty use the body as the initial description - as currently. - Use XML-RPC when available. Maybe use python-bugzilla: http://fedorahosted.org/python-bugzilla/ diff --git a/git-bz b/git-bz index 973f0a3..a3fb321 100755 --- a/git-bz +++ b/git-bz @@ -84,9 +84,8 @@ # # Like 'attach', but files a new bug. Opens an editor for the user to # enter the summary and description for the bug. If only a single commit -# is named summary defaults to the subject of the commit, and the description -# to the body of the bug. The product and component must be specified unless -# you have configured defaults. +# is named, the summary defaults to the subject of the commit. The product and +# component must be specified unless you have configured defaults. # # Examples: # @@ -997,8 +996,6 @@ def do_file(*args): template = StringIO() if len(commits) == 1: template.write(commits[0].subject) - template.write("\n\n") - template.write(get_body(commits[0])) template.write("\n") template.write(""" # Please enter the summary (first line) and description (other lines). Lines @@ -1018,12 +1015,21 @@ def do_file(*args): if summary == "": die("Empty summary, aborting") + # If we have only one patch and no other description for the bug was + # specified, use the body of the commit as the the description for + # the bug rather than the descriptionfor the attachment + include_comments=True + if len(commits) == 1: + if description == "": + description = get_body(commits[0]) + include_comments = False + bug = Bug.create(get_tracker(), product, component, summary, description) if global_options.add_url: add_url(bug, commits) - attach_commits(bug, commits, include_comments=(len(commits) > 1)) + attach_commits(bug, commits, include_comments=include_comments) ################################################################################ -- cgit v1.2.3