|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
1 |
== Create a new merge proposal == |
2 |
||
3 |
Branch merge proposals can be created through the API. |
|
4 |
||
|
7675.7083.1
by William Grant
Move the remains of canonical.launchpad.testing to lp.testing. |
5 |
>>> from lp.testing.pages import webservice_for_person |
|
7675.7096.2
by Curtis Hovey
Moved webapp to lp.services. |
6 |
>>> from lp.services.webapp.interfaces import OAuthPermission |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
7 |
>>> from lazr.restful.testing.webservice import pprint_entry |
8 |
>>> login('admin@canonical.com')
|
|
9 |
>>> target = factory.makeBranch() |
|
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
10 |
|
|
7675.7096.2
by Curtis Hovey
Moved webapp to lp.services. |
11 |
>>> from lp.services.webapp.servers import WebServiceTestRequest |
|
7675.2884.5
by Leonard Richardson
Made canonical_url work correctly with versioned web service requests. |
12 |
>>> request = WebServiceTestRequest(version="beta") |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
13 |
>>> request.processInputs() |
14 |
||
15 |
>>> from lazr.restful.utils import get_current_web_service_request |
|
16 |
>>> request = get_current_web_service_request() |
|
17 |
||
18 |
>>> def fix_url(url): |
|
19 |
... """Convert a browser request to a web service client request. |
|
20 |
... This is a bit of a hack, but it's the simplest way to get a |
|
21 |
... URL that the web service client will respect.""" |
|
22 |
... return url.replace("launchpad.dev/api/", "api.launchpad.dev/")
|
|
23 |
||
24 |
>>> target_url = fix_url(str(canonical_url( |
|
25 |
... target, request=request, rootsite='api'))) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
26 |
>>> source = factory.makeBranchTargetBranch(target.target) |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
27 |
>>> source_url = fix_url(str( |
28 |
... canonical_url(source, request=request, rootsite='api'))) |
|
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
29 |
>>> prerequisite = factory.makeBranchTargetBranch(target.target) |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
30 |
>>> prerequisite_url = fix_url(str(canonical_url( |
31 |
... prerequisite, request=request, rootsite='api'))) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
32 |
>>> registrant = source.registrant |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
33 |
>>> reviewer_url = fix_url(str(canonical_url( |
34 |
... factory.makePerson(), request=request, rootsite='api'))) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
35 |
>>> logout() |
36 |
>>> registrant_webservice = webservice_for_person( |
|
37 |
... registrant, permission=OAuthPermission.WRITE_PUBLIC) |
|
38 |
>>> bmp_result = registrant_webservice.named_post( |
|
|
7675.2173.6
by Aaron Bentley
Allow creating merge proposal with reviewers via API. |
39 |
... source_url, 'createMergeProposal', target_branch=target_url, |
|
7675.2173.11
by Aaron Bentley
Allow newlines in initial comment and commit message. |
40 |
... prerequisite_branch=prerequisite_url, |
41 |
... initial_comment='Merge\nit!', needs_review=True, |
|
42 |
... commit_message='It was merged!\n', reviewers=[reviewer_url], |
|
43 |
... review_types=['green']) |
|
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
44 |
>>> bmp_url = bmp_result.getHeader('Location')
|
45 |
>>> bmp = registrant_webservice.get(bmp_url).jsonBody() |
|
46 |
>>> pprint_entry(bmp) |
|
|
7675.2173.9
by Aaron Bentley
Simplify branch locations. |
47 |
address: u'mp+...@code.launchpad.dev' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
48 |
all_comments_collection_link: |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
49 |
u'http://api.launchpad.dev/devel/~.../+merge/.../all_comments' |
|
7675.10435.1
by Colin Watson
Give BranchMergeProposal a basic implementation of IBugLinkTarget. |
50 |
bugs_collection_link: |
51 |
u'http://api.launchpad.dev/devel/~.../+merge/.../bugs' |
|
|
7675.2173.11
by Aaron Bentley
Allow newlines in initial comment and commit message. |
52 |
commit_message: u'It was merged!\n' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
53 |
date_created: u'...' |
54 |
date_merged: None |
|
|
7675.2173.3
by Aaron Bentley
Export needs_review |
55 |
date_review_requested: u'...' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
56 |
date_reviewed: None |
|
9005.1.6
by Tim Penhey
Update the webservice for descriptions. |
57 |
description: u'Merge\nit!' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
58 |
merge_reporter_link: None |
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
59 |
merged_revision_id: None |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
60 |
merged_revno: None |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
61 |
prerequisite_branch_link: u'http://api.launchpad.dev/devel/~...' |
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
62 |
prerequisite_git_path: None |
63 |
prerequisite_git_repository_link: None |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
64 |
preview_diff_link: None |
|
7675.9341.1
by Celso Providelo
Isolating PreviewDiff-related changes as a preparation step for inline review comments feature. |
65 |
preview_diffs_collection_link: u'http://.../preview_diffs' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
66 |
private: False |
|
7675.2173.3
by Aaron Bentley
Export needs_review |
67 |
queue_status: u'Needs review' |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
68 |
registrant_link: u'http://api.launchpad.dev/devel/~person-name...' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
69 |
resource_type_link: |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
70 |
u'http://api.launchpad.dev/devel/#branch_merge_proposal' |
|
8731.11.7
by Tim Penhey
Fix the broken tests. |
71 |
reviewed_revid: None |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
72 |
reviewer_link: None |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
73 |
self_link: u'http://api.launchpad.dev/devel/~.../+merge/...' |
74 |
source_branch_link: u'http://api.launchpad.dev/devel/~...' |
|
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
75 |
source_git_path: None |
76 |
source_git_repository_link: None |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
77 |
superseded_by_link: None |
78 |
supersedes_link: None |
|
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
79 |
target_branch_link: u'http://api.launchpad.dev/devel/~...' |
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
80 |
target_git_path: None |
81 |
target_git_repository_link: None |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
82 |
votes_collection_link: |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
83 |
u'http://api.launchpad.dev/devel/~.../+merge/.../votes' |
|
7675.4796.6
by Leonard Richardson
Got another batch of tests to pass. |
84 |
web_link: u'http://code.../~.../+merge/...' |
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
85 |
|
|
7675.2937.3
by Paul Hummer
Added failing test |
86 |
If we try and create the merge proposal again, we should get a ValueError. |
87 |
||
88 |
>>> print registrant_webservice.named_post( |
|
89 |
... source_url, 'createMergeProposal', target_branch=target_url, |
|
90 |
... prerequisite_branch=prerequisite_url, |
|
91 |
... initial_comment='Merge\nit!', needs_review=True, |
|
92 |
... commit_message='It was merged!\n', reviewers=[reviewer_url], |
|
93 |
... review_types=['green']) |
|
|
7675.4841.7
by Tim Penhey
Fix the traceback removal on the webservice tests. |
94 |
HTTP/1.1 400 Bad Request |
95 |
... |
|
96 |
There is already a branch merge proposal registered for branch |
|
97 |
... to land on ... that is still active. |
|
|
7675.2937.3
by Paul Hummer
Added failing test |
98 |
|
|
7675.2173.6
by Aaron Bentley
Allow creating merge proposal with reviewers via API. |
99 |
Our review request is listed in the votes collection. |
100 |
||
101 |
>>> votes = webservice.get( |
|
102 |
... bmp['votes_collection_link']).jsonBody() |
|
103 |
>>> pprint_entry(votes['entries'][0]) |
|
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
104 |
branch_merge_proposal_link: u'http://api.launchpad.dev/devel/~.../+merge/...' |
|
7675.2173.6
by Aaron Bentley
Allow creating merge proposal with reviewers via API. |
105 |
comment_link: None |
106 |
date_created: u'...' |
|
|
8731.7.1
by Tim Penhey
Add the is_pending bits to the webservice tests. |
107 |
is_pending: True |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
108 |
registrant_link: u'http://api.launchpad.dev/devel/~person-name...' |
109 |
resource_type_link: u'http://api.launchpad.dev/devel/#code_review_vote_reference' |
|
|
7675.2173.6
by Aaron Bentley
Allow creating merge proposal with reviewers via API. |
110 |
review_type: u'green' |
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
111 |
reviewer_link: u'http://api.launchpad.dev/devel/~person-name...' |
112 |
self_link: u'http://api.launchpad.dev/devel/~...' |
|
|
7675.2173.6
by Aaron Bentley
Allow creating merge proposal with reviewers via API. |
113 |
|
|
7325.8.2
by Paul Hummer
Added failing test for getting a branch merge proposal |
114 |
== Get an existing merge proposal == |
115 |
||
116 |
Branch merge proposals can be fetched through the API. |
|
117 |
||
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
118 |
>>> login('admin@canonical.com')
|
|
7675.4327.26
by Ian Booth
Fix some tests after merge from trunk |
119 |
>>> from lp.code.tests.helpers import ( |
120 |
... make_merge_proposal_without_reviewers) |
|
121 |
>>> fixit_proposal = make_merge_proposal_without_reviewers(factory) |
|
|
7675.12.7
by Paul Hummer
Got approved merge proposals working |
122 |
>>> fixit_proposal.source_branch.owner.name = 'source' |
123 |
>>> fixit_proposal.source_branch.name = 'fix-it' |
|
124 |
>>> fixit_proposal.target_branch.owner.name = 'target' |
|
125 |
>>> fixit_proposal.target_branch.name = 'trunk' |
|
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
126 |
>>> fooix = fixit_proposal.source_branch.product |
127 |
>>> fooix.name = 'fooix' |
|
|
7675.893.9
by Tim Penhey
Move CodeReviewVote enum. |
128 |
>>> from lp.code.enums import CodeReviewVote |
|
7675.21.1
by Paul Hummer
Added comments to the bmp api test |
129 |
>>> comment = factory.makeCodeReviewComment( |
130 |
... subject='Looks good', body='This is great work', |
|
131 |
... vote=CodeReviewVote.APPROVE, vote_tag='code', |
|
132 |
... merge_proposal=fixit_proposal) |
|
133 |
>>> comment2 = factory.makeCodeReviewComment( |
|
134 |
... subject='Not really', body='This is mediocre work.', |
|
135 |
... vote=CodeReviewVote.ABSTAIN, parent=comment, |
|
136 |
... merge_proposal=fixit_proposal) |
|
|
7176.8.22
by Stuart Bishop
Fix xx-branchmergeproposal.txt |
137 |
>>> transaction.commit() |
|
7675.21.1
by Paul Hummer
Added comments to the bmp api test |
138 |
|
|
7675.2884.9
by Leonard Richardson
Fix the branch merge proposal test in a way that doesn't break a whole lot of other tests. |
139 |
>>> proposal_url = fix_url(canonical_url( |
140 |
... fixit_proposal, request=request, rootsite='api')) |
|
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
141 |
>>> new_person = factory.makePerson() |
142 |
>>> target_owner = fixit_proposal.target_branch.owner |
|
|
7325.8.2
by Paul Hummer
Added failing test for getting a branch merge proposal |
143 |
>>> logout() |
144 |
||
|
7675.67.3
by Tim Penhey
Updates following review. |
145 |
We use the webservice as an unrelated, unprivileged user. |
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
146 |
|
147 |
>>> webservice = webservice_for_person( |
|
148 |
... new_person, permission=OAuthPermission.READ_PUBLIC) |
|
149 |
||
|
7325.8.2
by Paul Hummer
Added failing test for getting a branch merge proposal |
150 |
>>> merge_proposal = webservice.get(proposal_url).jsonBody() |
151 |
>>> pprint_entry(merge_proposal) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
152 |
address: u'mp+...@code.launchpad.dev' |
|
7675.10435.1
by Colin Watson
Give BranchMergeProposal a basic implementation of IBugLinkTarget. |
153 |
all_comments_collection_link: |
154 |
u'http://.../~source/fooix/fix-it/+merge/.../all_comments' |
|
155 |
bugs_collection_link: u'http://.../~source/fooix/fix-it/+merge/.../bugs' |
|
|
7325.8.8
by Paul Hummer
Added commit_message attribute |
156 |
commit_message: None |
|
7325.8.12
by Paul Hummer
Added date attributes |
157 |
date_created: ... |
|
7325.8.11
by Paul Hummer
Addded date_merged attribute |
158 |
date_merged: None |
|
7325.8.12
by Paul Hummer
Added date attributes |
159 |
date_review_requested: None |
160 |
date_reviewed: None |
|
|
9005.1.6
by Tim Penhey
Update the webservice for descriptions. |
161 |
description: None |
|
7325.8.16
by Paul Hummer
Added merge_reporter attribute |
162 |
merge_reporter_link: None |
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
163 |
merged_revision_id: None |
|
7325.8.10
by Paul Hummer
merged_revno attribute added |
164 |
merged_revno: None |
|
8489.4.1
by Aaron Bentley
Rename dependent branch to prerequisite branch. |
165 |
prerequisite_branch_link: None |
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
166 |
prerequisite_git_path: None |
167 |
prerequisite_git_repository_link: None |
|
|
7667.9.6
by Tim Penhey
Add traversal and tests. |
168 |
preview_diff_link: None |
|
7675.9341.1
by Celso Providelo
Isolating PreviewDiff-related changes as a preparation step for inline review comments feature. |
169 |
preview_diffs_collection_link: u'http://.../preview_diffs' |
|
7675.1800.4
by Aaron Bentley
Fix API test |
170 |
private: False |
|
7325.8.7
by Paul Hummer
Added queue_states attribute |
171 |
queue_status: u'Work in progress' |
|
8320.1.1
by Aaron Bentley
Support makeBranchMergeProposal for package branches |
172 |
registrant_link: u'http://.../~person-name...' |
|
7675.21.2
by Paul Hummer
Exposed IBranchMergeProposal.all_comments through the API |
173 |
resource_type_link: u'http://.../#branch_merge_proposal' |
|
8731.11.7
by Tim Penhey
Fix the broken tests. |
174 |
reviewed_revid: None |
|
7325.8.14
by Paul Hummer
Added reviewer_link attribute |
175 |
reviewer_link: None |
|
7675.21.2
by Paul Hummer
Exposed IBranchMergeProposal.all_comments through the API |
176 |
self_link: u'http://.../~source/fooix/fix-it/+merge/...' |
177 |
source_branch_link: u'http://.../~source/fooix/fix-it' |
|
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
178 |
source_git_path: None |
179 |
source_git_repository_link: None |
|
|
7325.8.18
by Paul Hummer
Added supersedes and superseded by |
180 |
superseded_by_link: None |
181 |
supersedes_link: None |
|
|
7675.21.2
by Paul Hummer
Exposed IBranchMergeProposal.all_comments through the API |
182 |
target_branch_link: u'http://.../~target/fooix/trunk' |
|
7675.9789.1
by Colin Watson
Model basic attributes of Git merge proposals, and add some corresponding helper properties to GitRef to make it look more like Branch. |
183 |
target_git_path: None |
184 |
target_git_repository_link: None |
|
|
7675.245.1
by Paul Hummer
Added tests for exposing the IBranchMergeProposal.votes |
185 |
votes_collection_link: u'http://.../~source/fooix/fix-it/+merge/.../votes' |
|
7675.4796.6
by Leonard Richardson
Got another batch of tests to pass. |
186 |
web_link: u'http://code.../~source/fooix/fix-it/+merge/...' |
|
7325.8.2
by Paul Hummer
Added failing test for getting a branch merge proposal |
187 |
|
|
7325.8.1
by Paul Hummer
Added branchmergeproposal test stub |
188 |
|
|
7675.21.3
by Paul Hummer
Added failing test for exposing ICodeReviewComment |
189 |
== Read the comments == |
190 |
||
191 |
The comments on a branch merge proposal are exposed through the API. |
|
192 |
||
193 |
>>> all_comments = webservice.get( |
|
194 |
... merge_proposal['all_comments_collection_link']).jsonBody() |
|
|
7675.21.5
by Paul Hummer
Refactored the test |
195 |
>>> print len(all_comments['entries']) |
196 |
2 |
|
197 |
>>> pprint_entry(all_comments['entries'][0]) |
|
|
7675.2134.10
by Aaron Bentley
Update test for API expansion. |
198 |
as_quoted_email: u'> This is great work' |
|
7675.3235.3
by Tim Penhey
Add the author link to the page test. |
199 |
author_link: u'http://api.launchpad.dev/devel/~...' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
200 |
branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...' |
|
7675.3235.4
by Tim Penhey
Export the date_created of the code review comment. |
201 |
date_created: u'...' |
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
202 |
id: ... |
|
7675.21.4
by Paul Hummer
Exposed the rest of CodeReviewComment |
203 |
message_body: u'This is great work' |
|
7675.48.19
by Paul Hummer
Fixed the tests to be more detailed |
204 |
resource_type_link: u'http://.../#code_review_comment' |
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
205 |
self_link: u'http://.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.788.19
by Tim Penhey
Make the branch displayname refer to bzr_identity instead of unique name. |
206 |
title: u'Comment on proposed merge of lp://dev/~source/fooix/fix-it into lp://dev/~target/fooix/trunk' |
|
7675.21.4
by Paul Hummer
Exposed the rest of CodeReviewComment |
207 |
vote: u'Approve' |
208 |
vote_tag: u'code' |
|
|
7675.4796.6
by Leonard Richardson
Got another batch of tests to pass. |
209 |
web_link: u'http://code.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.21.3
by Paul Hummer
Added failing test for exposing ICodeReviewComment |
210 |
|
|
7675.10102.1
by William Grant
Fix tests that depended on sequences of tables without sampledata. |
211 |
>>> comment_2_id = all_comments['entries'][1]['id'] |
|
7675.48.6
by Paul Hummer
Fixed test |
212 |
>>> comment_2 = webservice.named_get( |
|
7675.10102.1
by William Grant
Fix tests that depended on sequences of tables without sampledata. |
213 |
... merge_proposal['self_link'], 'getComment', |
214 |
... id=comment_2_id).jsonBody() |
|
|
7675.48.6
by Paul Hummer
Fixed test |
215 |
>>> pprint_entry(comment_2) |
|
7675.2134.10
by Aaron Bentley
Update test for API expansion. |
216 |
as_quoted_email: u'> This is mediocre work.' |
|
7675.3235.3
by Tim Penhey
Add the author link to the page test. |
217 |
author_link: u'http://api.launchpad.dev/devel/~...' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
218 |
branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...' |
|
7675.3235.4
by Tim Penhey
Export the date_created of the code review comment. |
219 |
date_created: u'...' |
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
220 |
id: ... |
|
7675.48.6
by Paul Hummer
Fixed test |
221 |
message_body: u'This is mediocre work.' |
222 |
resource_type_link: u'http://.../#code_review_comment' |
|
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
223 |
self_link: u'http://.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.788.19
by Tim Penhey
Make the branch displayname refer to bzr_identity instead of unique name. |
224 |
title: ... |
|
7675.48.6
by Paul Hummer
Fixed test |
225 |
vote: u'Abstain' |
226 |
vote_tag: None |
|
|
7675.4796.6
by Leonard Richardson
Got another batch of tests to pass. |
227 |
web_link: u'http://code.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.21.3
by Paul Hummer
Added failing test for exposing ICodeReviewComment |
228 |
|
|
7675.48.8
by Paul Hummer
Added test for isPersonValidReviewer |
229 |
|
|
7675.245.1
by Paul Hummer
Added tests for exposing the IBranchMergeProposal.votes |
230 |
== Check the votes == |
231 |
||
|
7675.245.3
by Paul Hummer
Responded to jml's review |
232 |
The votes on a branch merge proposal can be checked through the API. |
|
7675.245.1
by Paul Hummer
Added tests for exposing the IBranchMergeProposal.votes |
233 |
|
234 |
>>> votes = webservice.get( |
|
235 |
... merge_proposal['votes_collection_link']).jsonBody()['entries'] |
|
236 |
>>> print len(votes) |
|
237 |
2 |
|
238 |
>>> pprint_entry(votes[0]) |
|
239 |
branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...' |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
240 |
comment_link: u'http://.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.245.1
by Paul Hummer
Added tests for exposing the IBranchMergeProposal.votes |
241 |
date_created: u'...' |
|
8731.7.1
by Tim Penhey
Add the is_pending bits to the webservice tests. |
242 |
is_pending: False |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
243 |
registrant_link: u'http://.../~person-name...' |
|
7675.245.1
by Paul Hummer
Added tests for exposing the IBranchMergeProposal.votes |
244 |
resource_type_link: u'http://.../#code_review_vote_reference' |
245 |
review_type: u'code' |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
246 |
reviewer_link: u'http://.../~person-name...' |
|
7675.245.1
by Paul Hummer
Added tests for exposing the IBranchMergeProposal.votes |
247 |
self_link: u'http://.../~source/fooix/fix-it/+merge/.../+review/...' |
248 |
||
249 |
||
|
7675.48.8
by Paul Hummer
Added test for isPersonValidReviewer |
250 |
== Performing a Review == |
251 |
||
252 |
A review can be performed through the API. |
|
253 |
||
|
7675.1409.1
by Tim Penhey
Move isPersonTrustedReviewer to the IBranch interface. |
254 |
A review can be requested of the person 'target'. |
|
7675.48.9
by Paul Hummer
Added test for nominateReviewer |
255 |
|
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
256 |
>>> reviewer_webservice = webservice_for_person( |
257 |
... target_owner, permission=OAuthPermission.WRITE_PUBLIC) |
|
258 |
||
|
7675.1409.5
by Tim Penhey
Fix the breakage of the branchmergeproposal webservice story. |
259 |
>>> person = webservice.get('/~target').jsonBody()
|
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
260 |
>>> reviewer = reviewer_webservice.named_post( |
|
7675.48.9
by Paul Hummer
Added test for nominateReviewer |
261 |
... merge_proposal['self_link'], 'nominateReviewer', |
262 |
... reviewer=person['self_link'], review_type='code') |
|
|
7675.48.19
by Paul Hummer
Fixed the tests to be more detailed |
263 |
>>> print reviewer |
264 |
HTTP/1.1 200 Ok ... |
|
|
7675.48.22
by Paul Hummer
Responded to Michael's review |
265 |
>>> reviewer_entry = reviewer.jsonBody() |
266 |
>>> pprint_entry(reviewer_entry) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
267 |
branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...' |
|
7675.48.19
by Paul Hummer
Fixed the tests to be more detailed |
268 |
comment_link: None |
269 |
date_created: u'...' |
|
|
8731.7.1
by Tim Penhey
Add the is_pending bits to the webservice tests. |
270 |
is_pending: True |
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
271 |
registrant_link: u'http://.../~target' |
|
7675.48.19
by Paul Hummer
Fixed the tests to be more detailed |
272 |
resource_type_link: u'http://.../#code_review_vote_reference' |
273 |
review_type: u'code' |
|
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
274 |
reviewer_link: u'http://.../~target' |
|
7675.2173.6
by Aaron Bentley
Allow creating merge proposal with reviewers via API. |
275 |
self_link: u'http://.../~source/fooix/fix-it/+merge/.../+review/...' |
|
7675.48.9
by Paul Hummer
Added test for nominateReviewer |
276 |
|
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
277 |
>>> vote = reviewer_webservice.get(reviewer_entry['self_link']) |
|
7675.48.22
by Paul Hummer
Responded to Michael's review |
278 |
>>> print vote |
279 |
HTTP/1.1 200 Ok ... |
|
280 |
||
|
7675.48.11
by Paul Hummer
Working around circular imports still |
281 |
Now the code review should be made. |
282 |
||
|
7675.2066.42
by Aaron Bentley
Fix failing test. |
283 |
>>> comment_result = reviewer_webservice.named_post( |
|
7675.48.11
by Paul Hummer
Working around circular imports still |
284 |
... merge_proposal['self_link'], 'createComment', |
285 |
... subject='Great work', content='This is great work', |
|
|
7675.2066.42
by Aaron Bentley
Fix failing test. |
286 |
... vote=CodeReviewVote.APPROVE.title, review_type='code') |
|
7675.2173.5
by Aaron Bentley
Cleanup |
287 |
>>> comment_link = comment_result.getHeader('Location')
|
288 |
>>> comment = reviewer_webservice.get(comment_link).jsonBody() |
|
289 |
>>> pprint_entry(comment) |
|
|
7675.2134.10
by Aaron Bentley
Update test for API expansion. |
290 |
as_quoted_email: u'> This is great work' |
|
7675.3235.3
by Tim Penhey
Add the author link to the page test. |
291 |
author_link: u'http://api.launchpad.dev/devel/~...' |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
292 |
branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...' |
|
7675.3235.4
by Tim Penhey
Export the date_created of the code review comment. |
293 |
date_created: u'...' |
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
294 |
id: ... |
|
7675.48.11
by Paul Hummer
Working around circular imports still |
295 |
message_body: u'This is great work' |
|
7675.48.19
by Paul Hummer
Fixed the tests to be more detailed |
296 |
resource_type_link: u'http://.../#code_review_comment' |
|
7675.2173.2
by Aaron Bentley
Expose prerequisite_branch and initial comment. |
297 |
self_link: u'http://.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.788.19
by Tim Penhey
Make the branch displayname refer to bzr_identity instead of unique name. |
298 |
title: ... |
|
7675.48.13
by Paul Hummer
Got review test working |
299 |
vote: u'Approve' |
|
7675.48.11
by Paul Hummer
Working around circular imports still |
300 |
vote_tag: u'code' |
|
7675.4796.6
by Leonard Richardson
Got another batch of tests to pass. |
301 |
web_link: u'http://code.../~source/fooix/fix-it/+merge/.../comments/...' |
|
7675.48.8
by Paul Hummer
Added test for isPersonValidReviewer |
302 |
|
|
7675.1240.9
by Paul Hummer
Exposed IBranchMergeProposal.setStatus through the API |
303 |
In fact, now that the votes indicate approval, we might as well set the merge |
304 |
proposal status to "Approved" as well. |
|
305 |
||
306 |
>>> _unused = reviewer_webservice.named_post( |
|
307 |
... merge_proposal['self_link'], 'setStatus', |
|
|
8731.11.7
by Tim Penhey
Fix the broken tests. |
308 |
... status=u'Approved', revid=u'25') |
|
7675.1240.9
by Paul Hummer
Exposed IBranchMergeProposal.setStatus through the API |
309 |
>>> merge_proposal = reviewer_webservice.get( |
310 |
... merge_proposal['self_link']).jsonBody() |
|
311 |
||
312 |
>>> print merge_proposal['queue_status'] |
|
313 |
Approved |
|
|
8731.11.7
by Tim Penhey
Fix the broken tests. |
314 |
>>> print merge_proposal['reviewed_revid'] |
|
7675.1240.9
by Paul Hummer
Exposed IBranchMergeProposal.setStatus through the API |
315 |
25 |
316 |
||
|
7675.1240.11
by Paul Hummer
Added test for ensuring revision_id argument to IBranchMergeProposal.setStatus is optional |
317 |
However, there may have been breakage in the branch, and we need to revert back |
318 |
to "Work In Progress" and not specify the revision_id. |
|
319 |
||
320 |
>>> _unused = reviewer_webservice.named_post( |
|
321 |
... merge_proposal['self_link'], 'setStatus', |
|
322 |
... status=u'Work in progress') |
|
323 |
>>> merge_proposal = reviewer_webservice.get( |
|
324 |
... merge_proposal['self_link']).jsonBody() |
|
325 |
||
326 |
>>> print merge_proposal['queue_status'] |
|
327 |
Work in progress |
|
|
8731.11.7
by Tim Penhey
Fix the broken tests. |
328 |
>>> print merge_proposal['reviewed_revid'] |
|
7675.1240.11
by Paul Hummer
Added test for ensuring revision_id argument to IBranchMergeProposal.setStatus is optional |
329 |
None |
330 |
||
|
7675.12.1
by Paul Hummer
Added failing test |
331 |
== Getting a Project's Pending Merge Proposals == |
332 |
||
333 |
It is possible to view all of a project's merge proposals or filter the |
|
334 |
proposals by their status. |
|
335 |
||
|
7675.12.7
by Paul Hummer
Got approved merge proposals working |
336 |
>>> def print_proposal(proposal): |
|
7675.12.6
by Paul Hummer
Added status checking to the test |
337 |
... print proposal['self_link'] + ' - ' + \ |
338 |
... proposal['queue_status'] |
|
|
7675.12.7
by Paul Hummer
Got approved merge proposals working |
339 |
|
340 |
||
341 |
>>> proposals = webservice.named_get( |
|
342 |
... '/fooix', 'getMergeProposals').jsonBody() |
|
343 |
>>> for proposal in proposals['entries']: |
|
344 |
... print_proposal(proposal) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
345 |
http://.../~source/fooix/fix-it/+merge/... - Work in progress |
|
7675.12.1
by Paul Hummer
Added failing test |
346 |
|
347 |
||
|
7675.67.3
by Tim Penhey
Updates following review. |
348 |
Or I can look for anything that is approved. |
|
7675.12.7
by Paul Hummer
Got approved merge proposals working |
349 |
|
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
350 |
>>> login('admin@canonical.com')
|
|
7675.893.4
by Tim Penhey
Move BranchMergeProposalStatus. |
351 |
>>> from lp.code.enums import BranchMergeProposalStatus |
|
7675.67.2
by Tim Penhey
Fix the doctest to not use an admin. |
352 |
>>> fixit_proposal.approveBranch(fixit_proposal.target_branch.owner, '1') |
|
7675.12.7
by Paul Hummer
Got approved merge proposals working |
353 |
>>> logout() |
354 |
||
|
7675.191.7
by Paul Hummer
Responded to bac's review |
355 |
>>> def print_proposals(webservice, url, status=None): |
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
356 |
... proposals = webservice.named_get( |
|
7675.191.7
by Paul Hummer
Responded to bac's review |
357 |
... url, 'getMergeProposals', |
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
358 |
... status=status).jsonBody() |
359 |
... for proposal in proposals['entries']: |
|
360 |
... print_proposal(proposal) |
|
361 |
||
|
7675.191.7
by Paul Hummer
Responded to bac's review |
362 |
>>> print_proposals( |
363 |
... webservice, url='/fooix', |
|
364 |
... status=[BranchMergeProposalStatus.CODE_APPROVED.title]) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
365 |
http://.../~source/fooix/fix-it/+merge/... - Approved |
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
366 |
|
|
7675.67.3
by Tim Penhey
Updates following review. |
367 |
If the branch is private it is not visible to an unpriveleged user. |
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
368 |
|
369 |
>>> login('admin@canonical.com')
|
|
|
7675.596.24
by Barry Warsaw
thread merge |
370 |
>>> from zope.security.proxy import removeSecurityProxy |
|
7675.8449.6
by Rick Harding
Keep on changing |
371 |
>>> from lp.app.enums import InformationType |
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
372 |
>>> branch_owner = fixit_proposal.source_branch.owner |
|
7675.7889.2
by Ian Booth
Remove more cases of transitively_private and explcity_private |
373 |
>>> removeSecurityProxy( |
374 |
... fixit_proposal.source_branch).transitionToInformationType( |
|
375 |
... InformationType.USERDATA, branch_owner, verify_policy=False) |
|
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
376 |
>>> logout() |
377 |
||
|
7675.191.7
by Paul Hummer
Responded to bac's review |
378 |
>>> print_proposals( |
379 |
... webservice, url='/fooix', |
|
380 |
... status=[BranchMergeProposalStatus.CODE_APPROVED.title]) |
|
|
7675.67.1
by Tim Penhey
Commit interface update, and broken pagetest. |
381 |
|
382 |
If we get a webservice for the owner of the source branch, then they can see |
|
383 |
the proposal if they have allowed the API to access private bits. |
|
384 |
||
385 |
>>> service = webservice_for_person( |
|
386 |
... branch_owner, permission=OAuthPermission.READ_PRIVATE) |
|
|
7675.191.7
by Paul Hummer
Responded to bac's review |
387 |
>>> print_proposals( |
388 |
... service, url='/fooix', |
|
389 |
... status=[BranchMergeProposalStatus.CODE_APPROVED.title]) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
390 |
http://.../~source/fooix/fix-it/+merge/... - Approved |
|
7803.1.1
by Guilherme Salgado
merge from mainline |
391 |
|
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
392 |
>>> login('admin@canonical.com')
|
|
7675.7889.2
by Ian Booth
Remove more cases of transitively_private and explcity_private |
393 |
>>> removeSecurityProxy( |
394 |
... fixit_proposal.source_branch).transitionToInformationType( |
|
395 |
... InformationType.PUBLIC, branch_owner) |
|
|
7675.191.7
by Paul Hummer
Responded to bac's review |
396 |
>>> logout() |
397 |
||
|
7675.191.2
by Paul Hummer
Added tests, made things work |
398 |
|
399 |
== Getting a Person's Pending Merge Proposals == |
|
400 |
||
|
7675.191.8
by Paul Hummer
Minor style changes |
401 |
It is possible to view all of a person's merge proposals or filter their |
|
7675.191.2
by Paul Hummer
Added tests, made things work |
402 |
proposals by their status. |
403 |
||
|
7675.191.7
by Paul Hummer
Responded to bac's review |
404 |
>>> proposals = webservice.named_get('/~source', 'getMergeProposals',
|
405 |
... ).jsonBody() |
|
406 |
>>> print_proposals(service, url='/~source') |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
407 |
http://.../~source/fooix/fix-it/+merge/... - Approved |
|
7675.191.2
by Paul Hummer
Added tests, made things work |
408 |
|
409 |
The person's proposals can also be filtered by status. |
|
410 |
||
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
411 |
>>> login('admin@canonical.com')
|
|
7675.191.6
by Paul Hummer
Fixed the tests |
412 |
>>> fixit_proposal.rejectBranch(fixit_proposal.target_branch.owner, '1') |
|
7675.191.2
by Paul Hummer
Added tests, made things work |
413 |
>>> logout() |
414 |
||
|
7675.191.7
by Paul Hummer
Responded to bac's review |
415 |
>>> print_proposals(webservice, url='/~source', |
|
7675.191.6
by Paul Hummer
Fixed the tests |
416 |
... status=[BranchMergeProposalStatus.REJECTED.title]) |
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
417 |
http://.../~source/fooix/fix-it/+merge/... - Rejected |
|
7675.191.2
by Paul Hummer
Added tests, made things work |
418 |
|
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
419 |
|
|
7675.883.9
by Tim Penhey
Expose branches for a project through the api. |
420 |
== Getting a Project Group's Merge Proposals == |
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
421 |
|
|
7675.883.9
by Tim Penhey
Expose branches for a project through the api. |
422 |
Getting the merge proposals for a project group will get all the proposals for all |
423 |
the projects that are part of the project group. |
|
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
424 |
|
425 |
>>> login('admin@canonical.com')
|
|
|
7675.9680.1
by Colin Watson
Rename factory.makeProduct(project=) to projectgroup=, anticipating a similar change to Product itself. |
426 |
>>> projectgroup = factory.makeProject(name='widgets') |
|
7675.9682.1
by Colin Watson
Rename Product.project to Product.projectgroup. |
427 |
>>> fooix.projectgroup = projectgroup |
|
7675.9680.1
by Colin Watson
Rename factory.makeProduct(project=) to projectgroup=, anticipating a similar change to Product itself. |
428 |
>>> blob = factory.makeProduct(name='blob', projectgroup=projectgroup) |
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
429 |
>>> proposal = factory.makeBranchMergeProposal( |
430 |
... product=blob, set_state=BranchMergeProposalStatus.NEEDS_REVIEW) |
|
431 |
>>> proposal.source_branch.owner.name = 'mary' |
|
432 |
>>> proposal.source_branch.name = 'bar' |
|
433 |
>>> logout() |
|
434 |
||
435 |
By default only work in progress, needs review and approved proposals are |
|
436 |
returned. |
|
437 |
||
438 |
>>> print_proposals(webservice, url='/widgets') |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
439 |
http://.../~mary/blob/bar/+merge/... - Needs review |
|
7675.883.6
by Tim Penhey
Get the branch merge proposals for a project.~ |
440 |
|
441 |
The proposals can also be filtered by status. |
|
442 |
||
443 |
>>> print_proposals(webservice, url='/widgets', |
|
444 |
... status=[BranchMergeProposalStatus.REJECTED.title]) |
|
|
7675.2173.1
by Aaron Bentley
Initial support for addLandingTarget. |
445 |
http://.../~source/fooix/fix-it/+merge/... - Rejected |
|
7675.2730.1
by James Westby
Export a method on IPerson to get the reviews they have been requested to do. |
446 |
|
|
7675.2730.2
by James Westby
Fixups from Tom's review. Thanks. |
447 |
== Getting Merge Proposals a Person has been Asked To Review == |
|
7675.2730.1
by James Westby
Export a method on IPerson to get the reviews they have been requested to do. |
448 |
|
449 |
It's good to be able to find out which proposals you have been asked to |
|
450 |
review. |
|
451 |
||
452 |
>>> login('admin@canonical.com')
|
|
453 |
>>> from lp.code.enums import BranchMergeProposalStatus |
|
|
7675.2730.5
by James Westby
Fix up the tests so that they are testing the correct thing. |
454 |
|
455 |
First we create a review owned by someone else and requested of 'target' |
|
456 |
which is the one we want the method to return. |
|
457 |
||
458 |
>>> source_branch = factory.makeBranch(owner=branch_owner, |
|
459 |
... product=blob, name="foo") |
|
460 |
>>> target_branch = factory.makeBranch(owner=target_owner, |
|
461 |
... product=blob, name="bar") |
|
462 |
>>> proposal = factory.makeBranchMergeProposal( |
|
463 |
... target_branch=target_branch, |
|
464 |
... product=blob, set_state=BranchMergeProposalStatus.NEEDS_REVIEW, |
|
465 |
... registrant=branch_owner, source_branch=source_branch) |
|
466 |
>>> proposal.nominateReviewer(target_owner, branch_owner) |
|
467 |
<CodeReviewVoteReference at ...> |
|
468 |
||
469 |
And then we propose a merge the other way, so that the owner is target, |
|
470 |
but they have not been asked to review, meaning that the method shouldn't |
|
471 |
return this review. |
|
472 |
||
473 |
>>> proposal = factory.makeBranchMergeProposal( |
|
474 |
... target_branch=source_branch, |
|
475 |
... product=blob, set_state=BranchMergeProposalStatus.NEEDS_REVIEW, |
|
476 |
... registrant=target_owner, source_branch=target_branch) |
|
477 |
>>> proposal.nominateReviewer(branch_owner, target_owner) |
|
478 |
<CodeReviewVoteReference at ...> |
|
|
7675.2730.1
by James Westby
Export a method on IPerson to get the reviews they have been requested to do. |
479 |
>>> logout() |
480 |
||
|
7675.2730.2
by James Westby
Fixups from Tom's review. Thanks. |
481 |
>>> proposals = webservice.named_get('/~target', 'getRequestedReviews'
|
|
7675.2730.1
by James Westby
Export a method on IPerson to get the reviews they have been requested to do. |
482 |
... ).jsonBody() |
483 |
>>> for proposal in proposals['entries']: |
|
484 |
... print_proposal(proposal) |
|
|
7675.10102.1
by William Grant
Fix tests that depended on sequences of tables without sampledata. |
485 |
http://.../~source/blob/foo/+merge/... - Needs review |
|
7675.2730.1
by James Westby
Export a method on IPerson to get the reviews they have been requested to do. |
486 |