diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2008-11-18 22:32:35 -0500 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2008-11-18 22:32:35 -0500 |
commit | e4b359d9ae6f76c8d565560e026adc7001b9b9aa (patch) | |
tree | a7c1969c6285a445b95a8ba54461e2bc053ec013 | |
parent | 7f34fb8f13cce5be52d5910ac86f81245e8d81d9 (diff) | |
download | git-bz-e4b359d9ae6f76c8d565560e026adc7001b9b9aa.tar.gz |
Don't include the URL in the attachment comment
Strip out the URL we add with -u when using the body of the commit
as the comment for an attachmnet; it's completely redundant to have
an URL pointing back to the bug page itself.
-rw-r--r-- | TODO | 6 | ||||
-rwxr-xr-x | git-bz | 10 |
2 files changed, 9 insertions, 7 deletions
@@ -6,12 +6,6 @@ any intention of working on it myself. - Owen -For attach -u don't include URL in the bugzilla comments - - For 'git bz attach -u', it's just noise to have the URL in the - bugzilla comment; simple: use the body *before* we add the URL - as the comment, not the body after. - Allow editing comment used for attachments When attaching a revised version of a patch, you really want to be @@ -735,6 +735,14 @@ def do_apply(bug_reference): commits = git.Commit.find_all(global_repo, "HEAD^!") add_url(bug, commits) +def strip_bug_url(bug, commit_body): + # Strip off the trailing bug URLs we add with -u; we do this before + # using commit body in as a comment; doing it by stripping right before + # posting means that we are robust against someone running add-url first + # and attach second. + pattern = "\s*" + re.escape(bug.get_url()) + "\s*$" + return re.sub(pattern, "", commit_body) + def attach_commits(bug, commits, include_comments=True): # We want to attach the patches in chronological order commits = list(commits) @@ -744,7 +752,7 @@ def attach_commits(bug, commits, include_comments=True): filename = make_filename(commit.message) + ".patch" patch = get_patch(commit) if include_comments: - body = get_body(commit) + body = strip_bug_url(bug, get_body(commit)) else: body = None bug.create_patch(commit.message, body, filename, patch) |