rbbz: strip commit metadata from Bugzilla descriptions (bug 1243486); r=dminor draft
authorGregory Szorc <gps@mozilla.com>
Tue, 02 Feb 2016 13:03:22 -0800
changeset 7112 e41e512eda19c4c3956a9ed3e8507bb2dbbc02dd
parent 7111 1af421167a356a8d008529139ad791dd00a3655a
child 7113 1201e404ad4ff4829d0ed24bd0aefdce481a5a28
push id594
push usergszorc@mozilla.com
push dateFri, 05 Feb 2016 20:03:35 +0000
reviewersdminor
bugs1243486
rbbz: strip commit metadata from Bugzilla descriptions (bug 1243486); r=dminor We don't want to litter the Bugzilla descriptions with metadata that isn't relevant to Bugzilla. Strip it. MozReview-Commit-ID: 4rjBfMdpHUF
pylib/mozreview/mozreview/bugzilla/attachments.py
--- a/pylib/mozreview/mozreview/bugzilla/attachments.py
+++ b/pylib/mozreview/mozreview/bugzilla/attachments.py
@@ -1,10 +1,14 @@
 from __future__ import unicode_literals
 
+from mozautomation.commitparser import (
+    strip_commit_metadata,
+)
+
 from mozreview.models import (
     BugzillaUserMap,
     get_or_create_bugzilla_users,
 )
 from mozreview.rb_utils import (
     get_obj_url,
 )
 
@@ -70,17 +74,19 @@ def post_bugzilla_attachment(bugzilla, b
     # Only post a comment if the diffset has actually changed
     comment = ''
     if review_request_draft.get_latest_diffset():
         diffset_count = review_request.diffset_history.diffsets.count()
         if diffset_count < 1:
             # We don't need the first line, since it is also the attachment
             # summary, which is displayed in the comment.
             extended_commit_msg = review_request_draft.description.partition(
-                '\n')[2].lstrip('\n')
+                '\n')[2].strip()
+
+            extended_commit_msg = strip_commit_metadata(extended_commit_msg)
 
             if extended_commit_msg:
                 extended_commit_msg += '\n\n'
 
             comment = '%sReview commit: %s\nSee other reviews: %s' % (
                 extended_commit_msg,
                 diff_url,
                 rr_url