summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2008-12-03 22:49:53 -0500
committerOwen W. Taylor <otaylor@fishsoup.net>2008-12-03 23:15:06 -0500
commit33af368350715559855c2828e64303a925ffa6a8 (patch)
tree2763358f71268c9d6728a5b728b5be142e4c5c1c
parente972dea29b26e0538a87e5faba0b4e4d473cb024 (diff)
Skip prompting about attachments when editing comment
If -e/--edit is specified and there is only one patch, go straight to the edit, the user can abort from there if necessary.
-rwxr-xr-xgit-bz23
1 files changed, 14 insertions, 9 deletions
diff --git a/git-bz b/git-bz
index 389785f..973f0a3 100755
--- a/git-bz
+++ b/git-bz
@@ -878,13 +878,14 @@ def strip_bug_url(bug, commit_body):
def edit_attachment_comment(bug, initial_description, initial_body):
template = StringIO()
+ template.write("# Attachment to Bug %d - %s\n\n" % (bug.id, bug.short_desc))
template.write(initial_description)
template.write("\n\n")
template.write(initial_body)
template.write("\n\n")
if len(bug.patches) > 0:
for patch in bug.patches:
- template.write("#Obsoletes: %d -%s\n" % (patch.attach_id, patch.description))
+ template.write("#Obsoletes: %d - %s\n" % (patch.attach_id, patch.description))
template.write("\n")
template.write("""# Please edit the description (first line) and comment (other lines). Lines
@@ -939,16 +940,20 @@ def do_attach(bug_reference, since_or_revision_range):
bug = Bug.load(bug_reference)
- print "Bug %d - %s" % (bug.id, bug.short_desc)
- print
+ # We always want to prompt if the user has specified multiple attachments.
+ # For the common case of one attachment don't prompt if we are going
+ # to give them a chance to edit and abort anyways.
+ if len(commits) > 1 or not global_options.edit:
+ print "Bug %d - %s" % (bug.id, bug.short_desc)
+ print
- for commit in commits:
- print commit.id[0:7], commit.subject
+ for commit in commits:
+ print commit.id[0:7], commit.subject
- print
- if not prompt("Attach?"):
- print "Aborting"
- sys.exit(0)
+ print
+ if not prompt("Attach?"):
+ print "Aborting"
+ sys.exit(0)
if global_options.add_url:
add_url(bug, commits)