summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-03-12 16:27:35 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2012-03-13 12:29:10 -0400
commit1cef6f1875462583e57d1543f313d4b4c585149f (patch)
tree5c41b9fb2b7b9efeee0fbc4013ed69cfc7600eaa
parent31088e0d0ef177358831363f547084c76f8e8451 (diff)
attach: Obsolete patches with the same subject
For plain 'git bz attach', always obsolete existing patches if they have the same subject as the commit being attached. For 'git bz attach -e', make this the default. https://bugzilla.gnome.org/show_bug.cgi?id=671941
-rwxr-xr-xgit-bz7
-rw-r--r--git-bz.txt5
2 files changed, 11 insertions, 1 deletions
diff --git a/git-bz b/git-bz
index 0554f16..1259d6f 100755
--- a/git-bz
+++ b/git-bz
@@ -1725,7 +1725,8 @@ def edit_attachment_comment(bug, initial_description, 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))
+ obsoleted = (initial_description == patch.description)
+ template.write("%sObsoletes: %d - %s\n" % ("" if obsoleted else "#", patch.attach_id, patch.description))
template.write("\n")
template.write("""# Please edit the description (first line) and comment (other lines). Lines
@@ -1771,6 +1772,10 @@ def attach_commits(bug, commits, include_comments=True, edit_comments=False, sta
else:
description = commit.subject
obsoletes = []
+ for attachment in bug.patches:
+ if attachment.description == commit.subject:
+ obsoletes.append(attachment.attach_id)
+
bug.create_patch(description, body, filename, patch, obsoletes=obsoletes, status=status)
def do_attach(*args):
diff --git a/git-bz.txt b/git-bz.txt
index 9817120..02df8d1 100644
--- a/git-bz.txt
+++ b/git-bz.txt
@@ -187,6 +187,11 @@ to the bug (see 'git bz add-url'). This can be suppressed with the
allow the user to edit the description and comment for each patch,
and (by uncommenting lines) obsolete old patches.
+When a commit with the same subject as an existing patch is attached,
+this is interpreted as a new version of the existing patch and the old
+patch is obsoleted. (With '-e', the obsoletes line can be commented
+to suppress this.)
+
Examples:
----------------------------------------
# Attach the last commit