--- a/hgext/reviewboard/hgrb/proto.py
+++ b/hgext/reviewboard/hgrb/proto.py
@@ -300,16 +300,17 @@ def _processpushreview(repo, req, ldap_u
if req.get('deduce-reviewers', True):
reviewers = list(commitparser.parse_rquestion_reviewers(summary))
requal_reviewers = list(commitparser.parse_requal_reviewers(summary))
else:
reviewers = []
requal_reviewers = []
commits['individual'].append({
'id': node,
+ 'author': encoding.fromlocal(ctx.user()),
'precursors': precursors.get(node, []),
'message': encoding.fromlocal(ctx.description()),
# Diffs are arbitrary byte sequences. json.dump() will try to
# interpret str as UTF-8, which could fail. Instead of trying
# to coerce the str to a unicode or use ensure_ascii=False (which
# is a giant pain), just base64 encode the diff in the JSON.
'diff_b64': diff.encode('base64'),
'bug': str(reviewid.bug),
--- a/hgext/reviewboard/tests/test-commits-deleted-no-obsolescence.t
+++ b/hgext/reviewboard/tests/test-commits-deleted-no-obsolescence.t
@@ -243,16 +243,17 @@ Review 6 should be marked as discarded
- Bug 1 - Foo 5
- ''
- 'MozReview-Commit-ID: JmjAjw'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4e50148c492dde95397cd666f2d4e4ad4fd2176f
p2rb.first_public_ancestor: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 6
revision: 1
base_commit_id: 4d0f846364eb509a1b6ae3294f05439101f6e7d3
@@ -316,16 +317,17 @@ The review request corresponding to the
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 0b3e14fe3ff19019110705e72dcf563c0ef551f6
p2rb.first_public_ancestor: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
--- a/hgext/reviewboard/tests/test-commits-deleted-obsolescence.t
+++ b/hgext/reviewboard/tests/test-commits-deleted-obsolescence.t
@@ -348,16 +348,17 @@ Review 6 should be marked as discarded
- Bug 1 - Foo 5
- ''
- 'MozReview-Commit-ID: JmjAjw'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4e50148c492dde95397cd666f2d4e4ad4fd2176f
p2rb.first_public_ancestor: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 6
revision: 1
base_commit_id: 4d0f846364eb509a1b6ae3294f05439101f6e7d3
@@ -568,16 +569,17 @@ The dropped commit should now be discard
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 0b3e14fe3ff19019110705e72dcf563c0ef551f6
p2rb.first_public_ancestor: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
@@ -989,16 +991,17 @@ Review request 5 (whose commit was delet
- Bug 1 - Foo 4
- ''
- 'MozReview-Commit-ID: F63vXs'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: a27a94c54524d4331dec2f92f647067bfd6dfbd4
p2rb.first_public_ancestor: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 5
revision: 1
base_commit_id: 713878e22d952d478e88bfdef897fdfc73060351
@@ -1067,16 +1070,17 @@ Review request 5 (whose commit was delet
description:
- Bug 1 - Foo 6
- ''
- 'MozReview-Commit-ID: OTOPw0'
target_people: []
extra: {}
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3b99865d1bab8480235d913f4bcfc951fd9e3032
p2rb.first_public_ancestor: 93d9429b41ecf0d2ad8c62b6ea26686dd20330f4
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 15
revision: 1
base_commit_id: eeb6d49dcb0950d771959358f662cf2e5ddc9dc1
--- a/hgext/reviewboard/tests/test-operation-prevention.t
+++ b/hgext/reviewboard/tests/test-operation-prevention.t
@@ -85,16 +85,17 @@ Publishing the parent should succeed.
- Bug 1 - Initial commit to review
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4f4c73d9c6594a0a800a82758ceb6fb12a6b9f83
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
--- a/hgext/reviewboard/tests/test-review-request-approval.t
+++ b/hgext/reviewboard/tests/test-review-request-approval.t
@@ -55,16 +55,17 @@ Create a review request from an L1 user
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4f4c73d9c6594a0a800a82758ceb6fb12a6b9f83
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -101,16 +102,17 @@ Have an L1 user provide a ship it review
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4f4c73d9c6594a0a800a82758ceb6fb12a6b9f83
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -155,16 +157,17 @@ Have an L3 user provide a ship it review
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4f4c73d9c6594a0a800a82758ceb6fb12a6b9f83
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -213,16 +216,17 @@ Posting a new review without ship it sho
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4f4c73d9c6594a0a800a82758ceb6fb12a6b9f83
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -278,16 +282,17 @@ One more ship it should switch it back t
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 4f4c73d9c6594a0a800a82758ceb6fb12a6b9f83
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -351,16 +356,17 @@ Even though the author is L1, adding a n
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: f867b363f9fd58135c77672e3c34f222f16ff677
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -435,16 +441,17 @@ A new ship-it from L3 should give approv
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: f867b363f9fd58135c77672e3c34f222f16ff677
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -530,16 +537,17 @@ Opening issues, even from an L1 user, sh
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: f867b363f9fd58135c77672e3c34f222f16ff677
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -638,16 +646,17 @@ Fixing the issue should restore approval
- 'MozReview-Commit-ID: 124Bxg'
target_people:
- level1b
- level3
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: f867b363f9fd58135c77672e3c34f222f16ff677
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -754,16 +763,17 @@ Review requests created by L3 users
- 'MozReview-Commit-ID: F63vXs'
target_people:
- level1a
- level1b
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: b366ef9913208b4030857319aa20520f229a74f3
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://2/mynick
p2rb.is_squashed: false
diffs:
- id: 6
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -800,16 +810,17 @@ Even a ship-it from an L1 user will give
- 'MozReview-Commit-ID: F63vXs'
target_people:
- level1a
- level1b
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: b366ef9913208b4030857319aa20520f229a74f3
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://2/mynick
p2rb.is_squashed: false
diffs:
- id: 6
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -857,16 +868,17 @@ ship-its. Posting a new diff should not
- 'MozReview-Commit-ID: F63vXs'
target_people:
- level1a
- level1b
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: bedcf57f515ad540f582962e37ecd424d82424fd
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://2/mynick
p2rb.is_squashed: false
diffs:
- id: 6
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
--- a/hgext/reviewboard/tests/test-review-request-closed-discarded.t
+++ b/hgext/reviewboard/tests/test-review-request-closed-discarded.t
@@ -167,16 +167,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
@@ -208,16 +209,17 @@ Child review request with ID 3 should be
- Bug 1 - Foo 2
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3a446ae4382006c43cdfa5aa33c494f582736f35
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 3
revision: 1
base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
@@ -377,16 +379,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
@@ -411,16 +414,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs: []
Child review request with ID 3 should be re-opened...
@@ -437,16 +441,17 @@ Child review request with ID 3 should be
- Bug 1 - Foo 2
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3a446ae4382006c43cdfa5aa33c494f582736f35
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 3
revision: 1
base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
@@ -471,16 +476,17 @@ Child review request with ID 3 should be
- Bug 1 - Foo 2
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3a446ae4382006c43cdfa5aa33c494f582736f35
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs: []
There should still not be a visible attachment on the bug
@@ -603,16 +609,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
@@ -644,16 +651,17 @@ Child review request with ID 3 should be
- Bug 1 - Foo 2
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3a446ae4382006c43cdfa5aa33c494f582736f35
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 3
revision: 1
base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
--- a/hgext/reviewboard/tests/test-review-request-closed-submitted.t
+++ b/hgext/reviewboard/tests/test-review-request-closed-submitted.t
@@ -111,16 +111,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
@@ -150,16 +151,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 2
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3a446ae4382006c43cdfa5aa33c494f582736f35
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 3
revision: 1
base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
@@ -255,16 +257,17 @@ Child review request with ID 2 should be
- Bug 1 - Foo 1
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 7c5bdf0cec4a90edb36300f8f3679857f46db829
@@ -296,16 +299,17 @@ Child review request with ID 3 should be
- Bug 1 - Foo 2
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 3a446ae4382006c43cdfa5aa33c494f582736f35
p2rb.first_public_ancestor: 7c5bdf0cec4a90edb36300f8f3679857f46db829
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 3
revision: 1
base_commit_id: 98467d80785ec84dd871f213c167ed704a6d974d
--- a/hgext/reviewboard/tests/test-review-request-delete-draft.t
+++ b/hgext/reviewboard/tests/test-review-request-delete-draft.t
@@ -150,16 +150,17 @@ We should have a disagreement between pu
- Bug 1 - Initial commit
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 65e5c536f9cc5816ef28ebaff6a0db47b9af0fee
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -184,16 +185,17 @@ We should have a disagreement between pu
- Bug 1 - Initial commit
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 2c68bc327689343c967bcb80b9a3fd8d9bc50eb4
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 4
revision: 2
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -266,16 +268,17 @@ Discarding the parent review request dra
- Bug 1 - Initial commit
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 65e5c536f9cc5816ef28ebaff6a0db47b9af0fee
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
--- a/hgext/reviewboard/tests/test-specify-reviewers.t
+++ b/hgext/reviewboard/tests/test-specify-reviewers.t
@@ -222,16 +222,17 @@ Publishing series during push works
- 'MozReview-Commit-ID: cXO9WC'
target_people:
- remus
- romulus
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 214fce3608426755a50ae60ae8645eb9bc1f7537
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 10
revision: 1
base_commit_id: ccfcf9b70a65731d01240f24815edf0cf6b64739
--- a/hgext/reviewboard/tests/test-unicode.t
+++ b/hgext/reviewboard/tests/test-unicode.t
@@ -48,16 +48,17 @@ The globbing is patching over a bug in m
- "Bug 1 - Initial commit to review \u2019 \u3053"
- ''
- 'MozReview-Commit-ID: 124Bxg'
target_people: []
extra_data:
calculated_trophies: true
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 86ab97a5dd61e8ec7ff3c23212db732e3531af01
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://1/mynick
p2rb.is_squashed: false
diffs:
- id: 2
revision: 1
base_commit_id: 3a9f6899ef84c99841f546030b036d0124a863cf
@@ -185,16 +186,17 @@ Put some wonky byte sequences in the dif
description:
- Bug 2 - base
- ''
- 'MozReview-Commit-ID: 5ijR9k'
target_people: []
extra: {}
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 78025579528e119adf8ccc61727fccc1e23bda1c
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://2/mynick
p2rb.is_squashed: false
diffs:
- id: 4
revision: 1
base_commit_id: 86ab97a5dd61e8ec7ff3c23212db732e3531af01
@@ -236,16 +238,17 @@ Put some wonky byte sequences in the dif
description:
- Bug 2 - tip
- ''
- 'MozReview-Commit-ID: APOgLo'
target_people: []
extra: {}
commit_extra_data:
p2rb: true
+ p2rb.author: test
p2rb.commit_id: 6204fc917b213cf88051df32860d62ca91ae1422
p2rb.first_public_ancestor: 3a9f6899ef84c99841f546030b036d0124a863cf
p2rb.identifier: bz://2/mynick
p2rb.is_squashed: false
diffs:
- id: 5
revision: 1
base_commit_id: 78025579528e119adf8ccc61727fccc1e23bda1c
--- a/pylib/mozreview/mozreview/extension.py
+++ b/pylib/mozreview/mozreview/extension.py
@@ -32,16 +32,17 @@ from mozreview.batchreview.resources imp
batch_review_resource,
)
from mozreview.extra_data import (
is_parent,
)
from mozreview.fields import (
BaseCommitField,
CombinedReviewersField,
+ CommitAuthorField,
CommitsListField,
FileDiffReviewerField,
ImportCommitField,
PullCommitField,
TryField,
)
from mozreview.file_diff_reviewer.resources import (
file_diff_reviewer_resource,
@@ -265,16 +266,17 @@ class MozReviewExtension(Extension):
# The above hack forced Commits at the top, but the rest of these
# fields are fine below the Description.
ReviewRequestFieldsHook(self, 'main', [CombinedReviewersField])
ReviewRequestFieldsHook(self, 'main', [TryField])
ReviewRequestFieldsHook(self, 'main', [BaseCommitField])
ReviewRequestFieldsHook(self, 'main', [FileDiffReviewerField])
+ ReviewRequestFieldsHook(self, 'info', [CommitAuthorField])
# We want pull to appear first as it is the more robust way of
# retrieving changesets.
ReviewRequestFieldsHook(self, 'info', [PullCommitField])
ReviewRequestFieldsHook(self, 'info', [ImportCommitField])
# Use a custom method to calculate a review approval state.
MozReviewApprovalHook(self)
--- a/pylib/mozreview/mozreview/extra_data.py
+++ b/pylib/mozreview/mozreview/extra_data.py
@@ -17,28 +17,30 @@ from mozreview.models import (
)
MOZREVIEW_KEY = 'p2rb'
# Built-in extra_data keys:
REVIEWER_MAP_KEY = MOZREVIEW_KEY + '.reviewer_map'
# CommitData field keys:
+AUTHOR_KEY = MOZREVIEW_KEY + '.author'
BASE_COMMIT_KEY = MOZREVIEW_KEY + '.base_commit'
COMMIT_ID_KEY = MOZREVIEW_KEY + '.commit_id'
COMMITS_KEY = MOZREVIEW_KEY + '.commits'
DISCARD_ON_PUBLISH_KEY = MOZREVIEW_KEY + '.discard_on_publish_rids'
FIRST_PUBLIC_ANCESTOR_KEY = MOZREVIEW_KEY + '.first_public_ancestor'
IDENTIFIER_KEY = MOZREVIEW_KEY + '.identifier'
SQUASHED_KEY = MOZREVIEW_KEY + '.is_squashed'
UNPUBLISHED_KEY = MOZREVIEW_KEY + '.unpublished_rids'
# CommitData fields which should be automatically copied from
# draft_extra_data to extra_data when a review request is published.
DRAFTED_COMMIT_DATA_KEYS = (
+ AUTHOR_KEY,
FIRST_PUBLIC_ANCESTOR_KEY,
IDENTIFIER_KEY,
COMMIT_ID_KEY,
)
REVIEWID_RE = re.compile('bz://(\d+)/[^/]+')
logger = logging.getLogger(__name__)
--- a/pylib/mozreview/mozreview/fields.py
+++ b/pylib/mozreview/mozreview/fields.py
@@ -9,16 +9,17 @@ from django.utils.safestring import mark
from django.utils.translation import ugettext as _
from reviewboard.extensions.base import get_extension_manager
from reviewboard.reviews.fields import BaseReviewRequestField
from reviewboard.reviews.models import ReviewRequest, ReviewRequestDraft
from mozreview.autoland.models import AutolandEventLogEntry, AutolandRequest
from mozreview.extra_data import (
+ AUTHOR_KEY,
BASE_COMMIT_KEY,
COMMIT_ID_KEY,
COMMITS_KEY,
fetch_commit_data,
gen_child_rrs,
get_parent_rr,
is_parent,
is_pushed,
@@ -39,16 +40,21 @@ def ensure_review_request(review_request
class CommitDataBackedField(BaseReviewRequestField):
"""Base class field backed by CommitData rather then built-in extra_data.
This Field class will emulate the behavior of normal review
request fields but stores its data in CommitData.extra_data
and CommitData.draft_extra_data instead of the built-in
extra_data fields on ReviewRequest and ReviewRequestDraft.
+
+ Unlike built-in extra data fields, these values will not be
+ automatically copied from draft_extra_data to extra_data. If
+ that behaviour is desired, the field id should be added to
+ DRAFTED_EXTRA_DATA_KEYS (defined in extra_data.py).
"""
def load_value(self, review_request_details):
# This must use a CommitData for ``review_request_details`` instead
# of the one stored in ``self.commit_data``. See comment on
# BaseReviewRequestField
commit_data = fetch_commit_data(review_request_details)
return commit_data.get_for(review_request_details, self.field_id)
@@ -203,16 +209,28 @@ class PullCommitField(BaseReviewRequestF
return ''
return get_template('mozreview/hg-pull.html').render(Context({
'commit_id': commit_id,
'repo_path': repo_path,
}))
+class CommitAuthorField(CommitDataBackedField):
+ """Field for the author of the review request's commit"""
+ field_id = AUTHOR_KEY
+ label = _("Author")
+
+ def should_render(self, value):
+ # Only show this for child review requests as for parent review
+ # requests different constituent commits can have different authors.
+ # Also, do not show it if it's empty, because review requests created
+ # before the author field was introduced will not have this information.
+ return not is_parent(self.review_request_details) and value
+
class BaseCommitField(CommitDataBackedField):
"""Field for the commit a review request is based on.
This field stores the base commit that a parent review request is
based on (the parent commit of the first commit in the series).
A change in this value indicates that the review request series
has been rebased or some of the commits in the request have been
--- a/pylib/mozreview/mozreview/resources/batch_review_request.py
+++ b/pylib/mozreview/mozreview/resources/batch_review_request.py
@@ -43,16 +43,17 @@ from reviewboard.webapi.decorators impor
from reviewboard.webapi.encoder import (
status_to_string,
)
from reviewboard.webapi.resources import (
WebAPIResource,
)
from mozreview.extra_data import (
+ AUTHOR_KEY,
BASE_COMMIT_KEY,
COMMITS_KEY,
COMMIT_ID_KEY,
DISCARD_ON_PUBLISH_KEY,
fetch_commit_data,
FIRST_PUBLIC_ANCESTOR_KEY,
IDENTIFIER_KEY,
MOZREVIEW_KEY,
@@ -106,16 +107,17 @@ class BatchReviewRequestResource(WebAPIR
'squashed': {
'diff_b64': <squashed-diff-string encoded as base64>,
'base_commit_id': <commit-id-to-apply-diff-to> (optional),
'first_public_ancestor': <commit of first public ancestor> (optional),
},
'individual': [
{
'id': <commit-id>,
+ 'author': <commit-author>,
'precursors': [<previous changeset>],
'message': <commit-message>,
'diff_b64': <diff encoded as base64>,
'bug': <bug-id>,
'base_commit_id': <commit-id-to-apply-diffs-to> (optional),
'first_public_ancestor': <commit of first public ancestor> (optional),
'reviewers': [<user1>, <user2>, ...] (optional),
'requal_reviewers': [<user1>, <user2>, ...] (optional),
@@ -665,16 +667,17 @@ class BatchReviewRequestResource(WebAPIR
commit_data = fetch_commit_data(rr)
commit_data.extra_data.update({
MOZREVIEW_KEY: True,
IDENTIFIER_KEY: identifier,
SQUASHED_KEY: False,
})
commit_data.draft_extra_data.update({
+ AUTHOR_KEY: commit['author'],
IDENTIFIER_KEY: identifier,
})
commit_data.save(
update_fields=['extra_data', 'draft_extra_data'])
logger.info('%s: created review request %d for commit %s' % (
identifier, rr.id, node))
draft, warns = update_review_request(local_site, request,
@@ -908,16 +911,17 @@ def update_review_request(local_site, re
draft = ReviewRequestDraft.create(rr)
draft.summary = commit['message'].splitlines()[0]
draft.description = commit['message']
draft.bugs_closed = commit['bug']
commit_data = fetch_commit_data(draft)
commit_data.draft_extra_data.update({
+ AUTHOR_KEY: commit['author'],
COMMIT_ID_KEY: commit['id'],
FIRST_PUBLIC_ANCESTOR_KEY: commit['first_public_ancestor'],
})
commit_data.save(
update_fields=['draft_extra_data'])
reviewer_users, unrecognized_reviewers = \
resolve_reviewers(reviewer_cache, commit.get('reviewers', []))