summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Cormack <chris@bigballofwax.co.nz>2013-06-24 20:06:12 +1200
committerChris Cormack <chris@bigballofwax.co.nz>2013-06-24 20:06:12 +1200
commita13716cb7022cc96f8e1ca3103d85bd0509d45bd (patch)
tree1899103fbca714f4bddffba8db266526f51e5789
parent8c3331d5f4a6cd52190998fbb6c0785c261fc382 (diff)
parentc833e94426e3bf317d4780bd4cd240f9a8ede984 (diff)
downloadgit-bz-a13716cb7022cc96f8e1ca3103d85bd0509d45bd.tar.gz
Merge remote-tracking branch 'kc/fishsoup' into HEAD
-rwxr-xr-xgit-bz51
1 files changed, 46 insertions, 5 deletions
diff --git a/git-bz b/git-bz
index ae6f756..22d1bdd 100755
--- a/git-bz
+++ b/git-bz
@@ -1197,6 +1197,8 @@ class Bug(object):
self.resolution = bug.find("resolution").text
token = bug.find("token")
self.token = None if token is None else token.text
+ patch_complexity = bug.find("cf_patch_complexity")
+ self.patch_complexity = None if patch_complexity is None else patch_complexity.text
for attachment in bug.findall("attachment"):
if attachment.get("ispatch") == "1" and not attachment.get("isobsolete") == "1" :
@@ -1813,6 +1815,14 @@ def edit_attachment_comment(bug, initial_description, initial_body):
template.write("# Status: Pushed to Stable\n")
template.write("\n")
+ template.write("# Current patch-complexity: %s\n" % bug.patch_complexity)
+ template.write("# Patch-complexity: String patch\n")
+ template.write("# Patch-complexity: Trivial patch\n")
+ template.write("# Patch-complexity: Small patch\n")
+ template.write("# Patch-complexity: Medium patch\n")
+ template.write("# Patch-complexity: Large patch\n")
+ template.write("\n")
+
template.write("""# Please edit the description (first line) and comment (other lines). Lines
# starting with '#' will be ignored. Delete everything to abort.
""")
@@ -1823,6 +1833,7 @@ def edit_attachment_comment(bug, initial_description, initial_body):
obsoletes= []
statuses= []
+ patch_complexities = []
def filter_line(line):
m = re.match("^\s*Obsoletes\s*:\s*([\d]+)", line)
if m:
@@ -1832,6 +1843,10 @@ def edit_attachment_comment(bug, initial_description, initial_body):
if m:
statuses.append(m.group(1))
return False
+ m = re.match("^\s*Patch-complexity\s*:\s*(.+)", line)
+ if m:
+ patch_complexities.append(m.group(1))
+ return False
return True
lines = filter(filter_line, lines)
@@ -1841,7 +1856,7 @@ def edit_attachment_comment(bug, initial_description, initial_body):
if description == "":
die("Empty description, aborting")
- return description, comment, obsoletes, statuses
+ return description, comment, obsoletes, statuses, patch_complexities
def attach_commits(bug, commits, include_comments=True, edit_comments=False, status='none'):
# We want to attach the patches in chronological order
@@ -1856,7 +1871,7 @@ def attach_commits(bug, commits, include_comments=True, edit_comments=False, sta
else:
body = None
if edit_comments:
- description, body, obsoletes, statuses = edit_attachment_comment(bug, commit.subject, body)
+ description, body, obsoletes, statuses, patch_complexities = edit_attachment_comment(bug, commit.subject, body)
else:
description = commit.subject
obsoletes = []
@@ -1864,12 +1879,23 @@ def attach_commits(bug, commits, include_comments=True, edit_comments=False, sta
if attachment.description == commit.subject:
obsoletes.append(attachment.attach_id)
statuses = []
+ patch_complexities = []
+
+ bug_changes = {}
if len(statuses) > 0:
- bug_changes = {}
bug_changes['bug_status'] = statuses[0]
+
+ if len(patch_complexities) > 0:
+ bug_changes['cf_patch_complexity'] = patch_complexities[0]
+
+ if len(statuses) > 0 or len(patch_complexities) > 0:
bug.update(**bug_changes)
- print "Updated bug status to '%s'" % bug_changes['bug_status']
+ if len(patch_complexities) > 0:
+ print "Updated patch complexity to '%s'" % bug_changes['cf_patch_complexity']
+
+ if len(statuses) > 0:
+ print "Updated bug status to '%s'" % bug_changes['bug_status']
bug.create_patch(description, body, filename, patch, obsoletes=obsoletes, status=status)
@@ -1990,6 +2016,12 @@ def edit_bug(bug, applied_commits=None, fix_commits=None):
template.write("# Status: Pushed to Stable\n")
template.write("# Status: In Discussion\n")
+ template.write("# Patch-complexity: String patch\n")
+ template.write("# Patch-complexity: Trivial patch\n")
+ template.write("# Patch-complexity: Small patch\n")
+ template.write("# Patch-complexity: Medium patch\n")
+ template.write("# Patch-complexity: Large patch\n")
+
if mark_resolved:
template.write("# Comment to keep bug open\n")
elif bug.bug_status == "RESOLVED":
@@ -2048,19 +2080,25 @@ def edit_bug(bug, applied_commits=None, fix_commits=None):
status = m.group(1)
changed_attachments[int(m.group(2))] = status
return False
+ m = re.match("^\s*Patch-complexity\s*:\s*(.+)", line)
+ if m:
+ patch_complexities.append(m.group(1))
+ return False
return True
changed_attachments = {}
resolutions = []
statuses = []
+ patch_complexities = []
lines = filter(filter_line, lines)
comment = "".join(lines).strip()
bug_status = statuses[0] if len(statuses) > 0 else None
resolution = resolutions[0] if len(resolutions) > 0 else None
+ patch_complexity = patch_complexities[0] if len(patch_complexities) > 0 else None
- if bug_status is None and resolution is None and len(changed_attachments) == 0 and comment == "":
+ if patch_complexity is None and bug_status is None and resolution is None and len(changed_attachments) == 0 and comment == "":
print "No changes, not editing Bug %d - %s" % (bug.id, bug.short_desc)
return False
@@ -2078,6 +2116,9 @@ def edit_bug(bug, applied_commits=None, fix_commits=None):
comment = comment.replace(old_id, new_id)
bug_changes = {}
+ if patch_complexity is not None:
+ bug_changes['cf_patch_complexity'] = patch_complexity
+
if bug_status is not None:
bug_changes['bug_status'] = bug_status