mozreview: filter out commit message FileDiff from downloadable diff (bug 1346321) r=glob draft
authorPiotr Zalewa <pzalewa@mozilla.com>
Tue, 14 Mar 2017 13:58:32 +0100
changeset 10498 39f8f43ce2979a12eb30c9fecd9f09e83f64b703
parent 10485 06154c69e174a0d5d6140951fc5011ae9b49e79b
push id1567
push userbmo:pzalewa@mozilla.com
push dateThu, 16 Mar 2017 04:57:27 +0000
reviewersglob
bugs1346321
mozreview: filter out commit message FileDiff from downloadable diff (bug 1346321) r=glob Commit mesasge diff is returned along with other diffs in Download Diff feature. This causes errors and might lead to have a commit-message-{hashtag} file commited to a project. This fix is using commit message ids stored in extra_data['COMMIT_MSG_FILEDIFF_IDS_KEY'] to filter out all possible commit message FileDiffs. It is currently using the DownloadRawHook defined in fixuphook.py due to recursive import issue. MozReview-Commit-ID: 3QCM7NaN1On
hgext/reviewboard/tests/test-commit-message-as-file.t
hgext/reviewboard/tests/test-commits-deleted-no-obsolescence.t
hgext/reviewboard/tests/test-commits-deleted-obsolescence.t
hgext/reviewboard/tests/test-operation-prevention.t
hgext/reviewboard/tests/test-review-request-approval.t
hgext/reviewboard/tests/test-review-request-closed-discarded.t
hgext/reviewboard/tests/test-review-request-closed-submitted.t
hgext/reviewboard/tests/test-review-request-delete-draft.t
hgext/reviewboard/tests/test-specify-reviewers.t
hgext/reviewboard/tests/test-unicode.t
pylib/mozreview/mozreview/extension.py
pylib/mozreview/mozreview/hooks.py
--- a/hgext/reviewboard/tests/test-commit-message-as-file.t
+++ b/hgext/reviewboard/tests/test-commit-message-as-file.t
@@ -30,17 +30,17 @@
   review id:  bz://1/mynick
   review url: http://$DOCKER_HOSTNAME:$HGPORT1/r/1 (draft)
   
   (review requests lack reviewers; visit review url to assign reviewers)
   
   publish these review requests now (Yn)?  y
   (published review request 1)
 
-Commit message file should be created as a first in the set.
+Commit extra data fields should be created
 
   $ reviewboard dumpreview 2
   id: 2
   status: pending
   public: true
   bugs:
   - '1'
   commit: null
@@ -64,35 +64,28 @@ Commit message file should be created as
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: df67364c205763de5ad1d2c33fa78f87f6618289
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-df673 b/commit-message-df673
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-df673
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo.h b/foo.h
     - '--- a/foo.h'
     - +++ b/foo.h
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +foo1
     - ''
   approved: false
   approval_failure: A suitable reviewer has not given a "Ship It!"
 
-Amended commit message should result with a changed commit msg filediff content
+Amended commit message should result with a changed commit message ids extra 
+data, filename should remain the same.
 
   $ hg commit --amend -m 'Bug 1 - Foo 2 - amended'
   saved backup bundle to $TESTTMP/client/.hg/strip-backup/4a9cf7e91820-f76b5126-amend-backup.hg (glob)
   $ hg push
   pushing to ssh://$DOCKER_HOSTNAME:$HGPORT6/test-repo
   (adding commit id to 1 changesets)
   saved backup bundle to $TESTTMP/client/.hg/strip-backup/2358ed0ad9b5-42479a45-addcommitid.hg (glob)
   searching for changes
@@ -142,45 +135,29 @@ Amended commit message should result wit
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: df67364c205763de5ad1d2c33fa78f87f6618289
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-df673 b/commit-message-df673
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-df673
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo.h b/foo.h
     - '--- a/foo.h'
     - +++ b/foo.h
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +foo1
     - ''
   - id: 5
     revision: 2
     base_commit_id: df67364c205763de5ad1d2c33fa78f87f6618289
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-df673 b/commit-message-df673
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-df673
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 2 - amended
-    - +
-    - '+MozReview-Commit-ID: APOgLo'
     - diff --git a/foo.h b/foo.h
     - '--- a/foo.h'
     - +++ b/foo.h
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +foo1
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-commits-deleted-no-obsolescence.t
+++ b/hgext/reviewboard/tests/test-commits-deleted-no-obsolescence.t
@@ -261,24 +261,16 @@ Review 6 should be marked as discarded
     p2rb.is_squashed: false
   diffs:
   - id: 7
     revision: 1
     base_commit_id: 4d0f846364eb509a1b6ae3294f05439101f6e7d3
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-4d0f8 b/commit-message-4d0f8
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-4d0f8
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 5
-    - +
-    - '+MozReview-Commit-ID: JmjAjw'
     - diff --git a/foo5 b/foo5
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo5
     - '@@ -0,0 +1,1 @@'
     - +foo5
     - ''
   approved: false
@@ -346,24 +338,16 @@ The review request corresponding to the 
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-93d94 b/commit-message-93d94
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-93d94
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo1 b/foo1
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo1
     - '@@ -0,0 +1,1 @@'
     - +foo1
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-commits-deleted-obsolescence.t
+++ b/hgext/reviewboard/tests/test-commits-deleted-obsolescence.t
@@ -367,24 +367,16 @@ Review 6 should be marked as discarded
     p2rb.is_squashed: false
   diffs:
   - id: 7
     revision: 1
     base_commit_id: 4d0f846364eb509a1b6ae3294f05439101f6e7d3
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-4d0f8 b/commit-message-4d0f8
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-4d0f8
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 5
-    - +
-    - '+MozReview-Commit-ID: JmjAjw'
     - diff --git a/foo5 b/foo5
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo5
     - '@@ -0,0 +1,1 @@'
     - +foo5
     - ''
   approved: false
@@ -601,24 +593,16 @@ The dropped commit should now be discard
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-93d94 b/commit-message-93d94
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-93d94
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo1 b/foo1
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo1
     - '@@ -0,0 +1,1 @@'
     - +foo1
     - ''
   approved: false
@@ -1038,66 +1022,42 @@ Review request 5 (whose commit was delet
     p2rb.is_squashed: false
   diffs:
   - id: 6
     revision: 1
     base_commit_id: 713878e22d952d478e88bfdef897fdfc73060351
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-71387 b/commit-message-71387
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-71387
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 4
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo4 b/foo4
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo4
     - '@@ -0,0 +1,1 @@'
     - +foo4
     - ''
   - id: 12
     revision: 2
     base_commit_id: 607f375f35c0866a8e08bc1d6aaecc6ad259ed6e
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-71387 b/commit-message-71387
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-71387
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 4
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo4 b/foo4
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo4
     - '@@ -0,0 +1,1 @@'
     - +foo4
     - ''
   - id: 14
     revision: 3
     base_commit_id: eeb6d49dcb0950d771959358f662cf2e5ddc9dc1
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-71387 b/commit-message-71387
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-71387
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 4
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo4 b/foo4
     - new file mode 100644
     - '--- /dev/null'
     - +++ b/foo4
     - '@@ -0,0 +1,1 @@'
     - +foo4
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-operation-prevention.t
+++ b/hgext/reviewboard/tests/test-operation-prevention.t
@@ -100,24 +100,16 @@ Publishing the parent should succeed.
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-review-request-approval.t
+++ b/hgext/reviewboard/tests/test-review-request-approval.t
@@ -69,24 +69,16 @@ Create a review request from an L1 user
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: false
@@ -126,24 +118,16 @@ Have an L1 user provide a r+ review whic
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: false
@@ -193,24 +177,16 @@ Have an L3 user provide a r+ review whic
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: true
@@ -266,24 +242,16 @@ Posting a new review without r+ should c
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: false
@@ -348,24 +316,16 @@ One more r+ should switch it back to app
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: true
@@ -440,45 +400,29 @@ Even though the author is L1, adding a n
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   - id: 5
     revision: 2
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +modified
     - ''
   approved: true
@@ -551,45 +495,29 @@ A new r+ from L3 should give approval
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   - id: 5
     revision: 2
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +modified
     - ''
   approved: true
@@ -675,45 +603,29 @@ Opening issues, even from an L1 user, sh
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   - id: 5
     revision: 2
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +modified
     - ''
   approved: false
@@ -814,45 +726,29 @@ Fixing the issue should restore approval
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   - id: 5
     revision: 2
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit to review
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +modified
     - ''
   approved: true
@@ -961,24 +857,16 @@ Review requests created by L3 users
     p2rb.is_squashed: false
   diffs:
   - id: 7
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 2 - initial commit to review
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +author2
     - ''
   approved: false
@@ -1018,24 +906,16 @@ Even a ship-it from an L1 user will give
     p2rb.is_squashed: false
   diffs:
   - id: 7
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 2 - initial commit to review
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +author2
     - ''
   approved: true
@@ -1088,45 +968,29 @@ ship-its. Posting a new diff should not 
     p2rb.is_squashed: false
   diffs:
   - id: 7
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 2 - initial commit to review
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +author2
     - ''
   - id: 9
     revision: 2
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 2 - initial commit to review
-    - +
-    - '+MozReview-Commit-ID: F63vXs'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +modified2
     - ''
   approved: true
--- a/hgext/reviewboard/tests/test-review-request-closed-discarded.t
+++ b/hgext/reviewboard/tests/test-review-request-closed-discarded.t
@@ -185,24 +185,16 @@ Child review request with ID 2 should be
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-7c5bd b/commit-message-7c5bd
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-7c5bd
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo0
     - +foo1
     - ''
   approved: false
@@ -237,24 +229,16 @@ Child review request with ID 3 should be
     p2rb.is_squashed: false
   diffs:
   - id: 4
     revision: 1
     base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-98467 b/commit-message-98467
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-98467
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 2
-    - +
-    - '+MozReview-Commit-ID: 5ijR9k'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo1
     - +foo2
     - ''
   approved: false
@@ -421,24 +405,16 @@ Child review request with ID 2 should be
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-7c5bd b/commit-message-7c5bd
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-7c5bd
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo0
     - +foo1
     - ''
   approved: false
@@ -495,24 +471,16 @@ Child review request with ID 3 should be
     p2rb.is_squashed: false
   diffs:
   - id: 4
     revision: 1
     base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-98467 b/commit-message-98467
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-98467
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 2
-    - +
-    - '+MozReview-Commit-ID: 5ijR9k'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo1
     - +foo2
     - ''
   approved: false
@@ -678,24 +646,16 @@ Child review request with ID 2 should be
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-7c5bd b/commit-message-7c5bd
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-7c5bd
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo0
     - +foo1
     - ''
   approved: false
@@ -730,24 +690,16 @@ Child review request with ID 3 should be
     p2rb.is_squashed: false
   diffs:
   - id: 4
     revision: 1
     base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-98467 b/commit-message-98467
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-98467
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 2
-    - +
-    - '+MozReview-Commit-ID: 5ijR9k'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo1
     - +foo2
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-review-request-closed-submitted.t
+++ b/hgext/reviewboard/tests/test-review-request-closed-submitted.t
@@ -127,24 +127,16 @@ Child review request with ID 2 should be
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-7c5bd b/commit-message-7c5bd
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-7c5bd
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo0
     - +foo1
     - ''
   approved: false
@@ -177,24 +169,16 @@ Child review request with ID 2 should be
     p2rb.is_squashed: false
   diffs:
   - id: 4
     revision: 1
     base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-98467 b/commit-message-98467
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-98467
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 2
-    - +
-    - '+MozReview-Commit-ID: 5ijR9k'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo1
     - +foo2
     - ''
   approved: false
@@ -297,24 +281,16 @@ Child review request with ID 2 should be
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-7c5bd b/commit-message-7c5bd
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-7c5bd
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 1
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo0
     - +foo1
     - ''
   approved: false
@@ -349,24 +325,16 @@ Child review request with ID 3 should be
     p2rb.is_squashed: false
   diffs:
   - id: 4
     revision: 1
     base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-98467 b/commit-message-98467
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-98467
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Foo 2
-    - +
-    - '+MozReview-Commit-ID: 5ijR9k'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo1
     - +foo2
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-review-request-delete-draft.t
+++ b/hgext/reviewboard/tests/test-review-request-delete-draft.t
@@ -168,24 +168,16 @@ We should have a disagreement between pu
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +foo1
     - ''
   approved: false
@@ -307,24 +299,16 @@ Discarding the parent review request dra
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - Initial commit
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +foo1
     - ''
   approved: false
--- a/hgext/reviewboard/tests/test-specify-reviewers.t
+++ b/hgext/reviewboard/tests/test-specify-reviewers.t
@@ -236,24 +236,16 @@ Publishing series during push works
     p2rb.is_squashed: false
   diffs:
   - id: 11
     revision: 1
     base_commit_id: ccfcf9b70a65731d01240f24815edf0cf6b64739
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-ccfcf b/commit-message-ccfcf
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-ccfcf
-    - '@@ -0,0 +1,3 @@'
-    - +Bug 1 - More stuff; [r?remus, r?romulus]
-    - +
-    - '+MozReview-Commit-ID: cXO9WC'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,8 +1,9 @@'
     - ' initial'
     - ' blah'
     - ' blah'
     - ' blah'
--- a/hgext/reviewboard/tests/test-unicode.t
+++ b/hgext/reviewboard/tests/test-unicode.t
@@ -62,24 +62,16 @@ The globbing is patching over a bug in m
     p2rb.is_squashed: false
   diffs:
   - id: 3
     revision: 1
     base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
     name: diff
     extra: {}
     patch:
-    - diff --git a/commit-message-3a9f6 b/commit-message-3a9f6
-    - new file mode 100644
-    - '--- /dev/null'
-    - +++ b/commit-message-3a9f6
-    - '@@ -0,0 +1,3 @@'
-    - "+Bug 1 - Initial commit to review \u2019 \u3053"
-    - +
-    - '+MozReview-Commit-ID: 124Bxg'
     - diff --git a/foo b/foo
     - '--- a/foo'
     - +++ b/foo
     - '@@ -1,1 +1,1 @@'
     - -foo
     - +initial
     - ''
   approved: false
--- a/pylib/mozreview/mozreview/extension.py
+++ b/pylib/mozreview/mozreview/extension.py
@@ -54,16 +54,17 @@ from mozreview.fields import (
     TryField,
 )
 from mozreview.file_diff_reviewer.resources import (
     file_diff_reviewer_resource,
 )
 from mozreview.hooks import (
     CommitContextTemplateHook,
     MozReviewApprovalHook,
+    MozReviewDownloadRawHook,
 )
 from mozreview.hostingservice.bmo_bugtracker import (
     BMOBugTracker,
 )
 from mozreview.hostingservice.hmo_repository import (
     HMORepository,
 )
 from mozreview.ldap.resources import (
@@ -330,16 +331,18 @@ class MozReviewExtension(Extension):
         ReviewRequestFieldsHook(self, 'main', [BaseCommitField])
         ReviewRequestFieldsHook(self, 'main', [FileDiffReviewerField])
 
         ReviewRequestFieldsHook(self, 'info', [CommitAuthorField])
 
         # Use a custom method to calculate a review approval state.
         MozReviewApprovalHook(self)
 
+        MozReviewDownloadRawHook(self)
+
         # Instantiate the various signal handlers
         initialize_signal_handlers(self)
 
         HostingServiceHook(self, HMORepository)
         HostingServiceHook(self, BMOBugTracker)
 
     def shutdown(self):
         # Restore the built-in opcode generator.
--- a/pylib/mozreview/mozreview/hooks.py
+++ b/pylib/mozreview/mozreview/hooks.py
@@ -1,23 +1,26 @@
 from __future__ import unicode_literals
 
 import logging
+import json
 
 from django.template.loader import Context
 from django.utils.translation import ugettext as _
 
 from reviewboard.extensions.hooks import (
     ReviewRequestApprovalHook,
     ReviewRequestFieldsHook,
     TemplateHook
 )
+from reviewboard.extensions.fixuphook import DownloadRawHook
 
 from mozreview.extra_data import (
     COMMIT_ID_KEY,
+    COMMIT_MSG_FILEDIFF_IDS_KEY,
     fetch_commit_data,
     gen_child_rrs,
     get_parent_rr,
     is_parent,
     is_pushed,
 )
 from mozreview.models import (
     get_profile,
@@ -26,16 +29,41 @@ from mozreview.review_helpers import (
     has_valid_shipit,
     has_l3_shipit,
 )
 from mozreview.template_helpers import get_commit_table_context
 
 
 logger = logging.getLogger(__name__)
 
+
+class MozReviewDownloadRawHook(DownloadRawHook):
+    def filter(self, files):
+        """Filter out commit message FileDiff."""
+        if not files:
+            return []
+
+        history = files[0].diffset.history
+        if not history:
+            # No history, no commit message FileDiff has been created yet
+            return files
+
+        rr = history.review_request.all()[0]
+        commit_data = fetch_commit_data(rr)
+        commit_msg_ids = commit_data.get_for(
+            rr, COMMIT_MSG_FILEDIFF_IDS_KEY)
+        # ReviewRequests created before implementing commit message FileDiff
+        # have no COMMIT_MSG_FILEDIFF_IDS_KEY in their extra_data.
+        if not commit_msg_ids:
+            return files
+
+        commit_msg_ids = json.loads(commit_msg_ids).values()
+        return [x for x in files if x.id not in commit_msg_ids]
+
+
 class CommitContextTemplateHook(TemplateHook):
     """Gathers all information required for commits table
 
     This hook allows us to generate a detailed, custom commits table.
     Information provided includes the parent and child review requests,
     as well as autoland information.
     """