Merge lp:~lifeless/launchpad/merge into lp:launchpad
- merge
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Tim Penhey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 10831 |
Proposed branch: | lp:~lifeless/launchpad/merge |
Merge into: | lp:launchpad |
Diff against target: |
292 lines (+95/-36) 6 files modified
lib/lp/code/configure.zcml (+0/-1) lib/lp/code/doc/branch-merge-proposals.txt (+1/-1) lib/lp/code/interfaces/branchmergeproposal.py (+3/-3) lib/lp/code/model/branchmergeproposal.py (+28/-25) lib/lp/code/model/tests/test_branchmergeproposals.py (+62/-5) lib/lp/testing/factory.py (+1/-1) |
To merge this branch: | bzr merge lp:~lifeless/launchpad/merge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | Approve | ||
Review via email: mp+23523@code.launchpad.net |
Commit message
Merge proposal tidy up: always dequeue when leaving the queued state; permit merge-failed; store the reviewed revid when queueing by default.
Description of the change
Fix a few bugs around merge proposals:
- when transitioning out of 'queued', always dequeue.
- permit transitioning to merge-failed
- use the reviewed revid by default when queueing
Robert Collins (lifeless) wrote : | # |
Ugh, there are tabs in teh diff. Fail-vim-rc-in-vm. will fix.
There are already tests for pasing in a revid to setStatus(QUEUED, revision_id=).
mergeFailed seems damaged, it uses self.merger, which isn't defined or used anywhere.
If I can change its definition, I can call it - so I'll do that change.
...
Have looked into it, mergeFailed isn't used anywhere, isn't exposed in API's and is buggy today (it doesn't dequeue completely). Its behaviour isn't tested either. To fix it and make it safe to call any point will either make setStatus significantly more complex (have to call dequeue when moving from QUEUED in every case except when moving to MERGE_FAILED), or it will make mergeFailed complex (have to accept being called when not in state QUEUED).
I looked for and could not find docs saying about whether setStatus was being deleted, or the other functions were, or something else, and couldn't find anything, so I took the approach that leaves the least code, with no reduction in capabilities - deleting mergeFailed.
Robert Collins (lifeless) wrote : | # |
Thanks for the review.
Robert Collins (lifeless) wrote : | # |
Tim, I've checked for the transition you were concerned about (non reviewer -> merge failed) and tightened that up appropriately, with a test.
Tim Penhey (thumper) wrote : | # |
This is good enough for now, but I really want to refactor the guts out of this whole area.
Preview Diff
1 | === modified file 'lib/lp/code/configure.zcml' | |||
2 | --- lib/lp/code/configure.zcml 2010-04-28 22:03:05 +0000 | |||
3 | +++ lib/lp/code/configure.zcml 2010-04-29 22:33:35 +0000 | |||
4 | @@ -246,7 +246,6 @@ | |||
5 | 246 | requestReview | 246 | requestReview |
6 | 247 | approveBranch | 247 | approveBranch |
7 | 248 | rejectBranch | 248 | rejectBranch |
8 | 249 | mergeFailed | ||
9 | 250 | markAsMerged | 249 | markAsMerged |
10 | 251 | resubmit | 250 | resubmit |
11 | 252 | enqueue | 251 | enqueue |
12 | 253 | 252 | ||
13 | === modified file 'lib/lp/code/doc/branch-merge-proposals.txt' | |||
14 | --- lib/lp/code/doc/branch-merge-proposals.txt 2010-02-26 00:30:09 +0000 | |||
15 | +++ lib/lp/code/doc/branch-merge-proposals.txt 2010-04-29 22:33:35 +0000 | |||
16 | @@ -348,7 +348,7 @@ | |||
17 | 348 | Anyone that has rights to edit the merge proposal can say that the | 348 | Anyone that has rights to edit the merge proposal can say that the |
18 | 349 | merge failed. | 349 | merge failed. |
19 | 350 | 350 | ||
21 | 351 | >>> proposal.mergeFailed(merger=sample_person) | 351 | >>> proposal.setStatus(BranchMergeProposalStatus.MERGE_FAILED) |
22 | 352 | >>> print proposal.queue_status.title | 352 | >>> print proposal.queue_status.title |
23 | 353 | Code failed to merge | 353 | Code failed to merge |
24 | 354 | 354 | ||
25 | 355 | 355 | ||
26 | === modified file 'lib/lp/code/interfaces/branchmergeproposal.py' | |||
27 | --- lib/lp/code/interfaces/branchmergeproposal.py 2010-03-05 03:35:10 +0000 | |||
28 | +++ lib/lp/code/interfaces/branchmergeproposal.py 2010-04-29 22:33:35 +0000 | |||
29 | @@ -338,6 +338,9 @@ | |||
30 | 338 | If the proposal is not in the Approved state before this method | 338 | If the proposal is not in the Approved state before this method |
31 | 339 | is called, approveBranch is called with the reviewer and revision_id | 339 | is called, approveBranch is called with the reviewer and revision_id |
32 | 340 | specified. | 340 | specified. |
33 | 341 | |||
34 | 342 | If None is supplied as the revision_id, the proposals | ||
35 | 343 | reviewed_revision_id is used. | ||
36 | 341 | """ | 344 | """ |
37 | 342 | 345 | ||
38 | 343 | def dequeue(): | 346 | def dequeue(): |
39 | @@ -350,9 +353,6 @@ | |||
40 | 350 | def moveToFrontOfQueue(): | 353 | def moveToFrontOfQueue(): |
41 | 351 | """Move the queue proposal to the front of the queue.""" | 354 | """Move the queue proposal to the front of the queue.""" |
42 | 352 | 355 | ||
43 | 353 | def mergeFailed(merger): | ||
44 | 354 | """Mark the proposal as 'Code failed to merge'.""" | ||
45 | 355 | |||
46 | 356 | def markAsMerged(merged_revno=None, date_merged=None, | 356 | def markAsMerged(merged_revno=None, date_merged=None, |
47 | 357 | merge_reporter=None): | 357 | merge_reporter=None): |
48 | 358 | """Mark the branch merge proposal as merged. | 358 | """Mark the branch merge proposal as merged. |
49 | 359 | 359 | ||
50 | === modified file 'lib/lp/code/model/branchmergeproposal.py' | |||
51 | --- lib/lp/code/model/branchmergeproposal.py 2010-02-26 09:54:20 +0000 | |||
52 | +++ lib/lp/code/model/branchmergeproposal.py 2010-04-29 22:33:35 +0000 | |||
53 | @@ -77,18 +77,29 @@ | |||
54 | 77 | [wip, needs_review, code_approved, rejected, | 77 | [wip, needs_review, code_approved, rejected, |
55 | 78 | merged, merge_failed, queued, superseded | 78 | merged, merge_failed, queued, superseded |
56 | 79 | ] = BranchMergeProposalStatus.items | 79 | ] = BranchMergeProposalStatus.items |
58 | 80 | # Transitioning to code approved, rejected or queued from | 80 | # Transitioning to code approved, rejected, failed or queued from |
59 | 81 | # work in progress, needs review or merge failed needs the | 81 | # work in progress, needs review or merge failed needs the |
60 | 82 | # user to be a valid reviewer, other states are fine. | 82 | # user to be a valid reviewer, other states are fine. |
61 | 83 | valid_reviewer = proposal.target_branch.isPersonTrustedReviewer(user) | 83 | valid_reviewer = proposal.target_branch.isPersonTrustedReviewer(user) |
70 | 84 | if (next_state == rejected and not valid_reviewer): | 84 | reviewed_ok_states = (code_approved, queued, merge_failed) |
71 | 85 | return False | 85 | if not valid_reviewer: |
72 | 86 | # Non-reviewers can toggle between code_approved and queued, but not | 86 | # Non reviewers cannot reject proposals [XXX: what about their own?] |
73 | 87 | # make anything else approved or queued. | 87 | if next_state == rejected: |
74 | 88 | elif (next_state in (code_approved, queued) and | 88 | return False |
75 | 89 | from_state not in (code_approved, queued) | 89 | # Non-reviewers can toggle within the reviewed ok states |
76 | 90 | and not valid_reviewer): | 90 | # (approved/queued/failed): they can dequeue something they spot an |
77 | 91 | return False | 91 | # environmental issue with (queued or failed to approved). Retry things |
78 | 92 | # that had an environmental issue (failed or approved to queued) and note | ||
79 | 93 | # things as failing (approved and queued to failed). | ||
80 | 94 | # This is perhaps more generous than needed, but its not clearly wrong | ||
81 | 95 | # - a key concern is to prevent non reviewers putting things in the | ||
82 | 96 | # queue that haven't been oked (and thus moved to approved or one of the | ||
83 | 97 | # workflow states that approved leads to). | ||
84 | 98 | elif (next_state in reviewed_ok_states and | ||
85 | 99 | from_state not in reviewed_ok_states): | ||
86 | 100 | return False | ||
87 | 101 | else: | ||
88 | 102 | return True | ||
89 | 92 | else: | 103 | else: |
90 | 93 | return True | 104 | return True |
91 | 94 | 105 | ||
92 | @@ -327,23 +338,23 @@ | |||
93 | 327 | # XXX - rockstar - 9 Oct 2008 - jml suggested in a review that this | 338 | # XXX - rockstar - 9 Oct 2008 - jml suggested in a review that this |
94 | 328 | # would be better as a dict mapping. | 339 | # would be better as a dict mapping. |
95 | 329 | # See bug #281060. | 340 | # See bug #281060. |
96 | 341 | if (self.queue_status == BranchMergeProposalStatus.QUEUED and | ||
97 | 342 | status != BranchMergeProposalStatus.QUEUED): | ||
98 | 343 | self.dequeue() | ||
99 | 330 | if status == BranchMergeProposalStatus.WORK_IN_PROGRESS: | 344 | if status == BranchMergeProposalStatus.WORK_IN_PROGRESS: |
100 | 331 | self.setAsWorkInProgress() | 345 | self.setAsWorkInProgress() |
101 | 332 | elif status == BranchMergeProposalStatus.NEEDS_REVIEW: | 346 | elif status == BranchMergeProposalStatus.NEEDS_REVIEW: |
102 | 333 | self.requestReview() | 347 | self.requestReview() |
103 | 334 | elif status == BranchMergeProposalStatus.CODE_APPROVED: | 348 | elif status == BranchMergeProposalStatus.CODE_APPROVED: |
110 | 335 | # Other half of the edge case. If the status is currently queued, | 349 | self.approveBranch(user, revision_id) |
105 | 336 | # we need to dequeue, otherwise we just approve the branch. | ||
106 | 337 | if self.queue_status == BranchMergeProposalStatus.QUEUED: | ||
107 | 338 | self.dequeue() | ||
108 | 339 | else: | ||
109 | 340 | self.approveBranch(user, revision_id) | ||
111 | 341 | elif status == BranchMergeProposalStatus.REJECTED: | 350 | elif status == BranchMergeProposalStatus.REJECTED: |
112 | 342 | self.rejectBranch(user, revision_id) | 351 | self.rejectBranch(user, revision_id) |
113 | 343 | elif status == BranchMergeProposalStatus.QUEUED: | 352 | elif status == BranchMergeProposalStatus.QUEUED: |
114 | 344 | self.enqueue(user, revision_id) | 353 | self.enqueue(user, revision_id) |
115 | 345 | elif status == BranchMergeProposalStatus.MERGED: | 354 | elif status == BranchMergeProposalStatus.MERGED: |
116 | 346 | self.markAsMerged(merge_reporter=user) | 355 | self.markAsMerged(merge_reporter=user) |
117 | 356 | elif status == BranchMergeProposalStatus.MERGE_FAILED: | ||
118 | 357 | self._transitionToState(status, user=user) | ||
119 | 347 | else: | 358 | else: |
120 | 348 | raise AssertionError('Unexpected queue status: ' % status) | 359 | raise AssertionError('Unexpected queue status: ' % status) |
121 | 349 | 360 | ||
122 | @@ -381,7 +392,7 @@ | |||
123 | 381 | 392 | ||
124 | 382 | def _reviewProposal(self, reviewer, next_state, revision_id, | 393 | def _reviewProposal(self, reviewer, next_state, revision_id, |
125 | 383 | _date_reviewed=None): | 394 | _date_reviewed=None): |
127 | 384 | """Set the proposal to one of the two review statuses.""" | 395 | """Set the proposal to next_state.""" |
128 | 385 | # Check the reviewer can review the code for the target branch. | 396 | # Check the reviewer can review the code for the target branch. |
129 | 386 | old_state = self.queue_status | 397 | old_state = self.queue_status |
130 | 387 | if not self.target_branch.isPersonTrustedReviewer(reviewer): | 398 | if not self.target_branch.isPersonTrustedReviewer(reviewer): |
131 | @@ -435,7 +446,7 @@ | |||
132 | 435 | self.queue_status = BranchMergeProposalStatus.QUEUED | 446 | self.queue_status = BranchMergeProposalStatus.QUEUED |
133 | 436 | self.queue_position = position | 447 | self.queue_position = position |
134 | 437 | self.queuer = queuer | 448 | self.queuer = queuer |
136 | 438 | self.queued_revision_id = revision_id | 449 | self.queued_revision_id = revision_id or self.reviewed_revision_id |
137 | 439 | self.date_queued = UTC_NOW | 450 | self.date_queued = UTC_NOW |
138 | 440 | self.syncUpdate() | 451 | self.syncUpdate() |
139 | 441 | 452 | ||
140 | @@ -467,14 +478,6 @@ | |||
141 | 467 | self.queue_position = first_entry.queue_position - 1 | 478 | self.queue_position = first_entry.queue_position - 1 |
142 | 468 | self.syncUpdate() | 479 | self.syncUpdate() |
143 | 469 | 480 | ||
144 | 470 | def mergeFailed(self, merger): | ||
145 | 471 | """See `IBranchMergeProposal`.""" | ||
146 | 472 | self._transitionToState( | ||
147 | 473 | BranchMergeProposalStatus.MERGE_FAILED, merger) | ||
148 | 474 | self.merger = merger | ||
149 | 475 | # Remove from the queue. | ||
150 | 476 | self.queue_position = None | ||
151 | 477 | |||
152 | 478 | def markAsMerged(self, merged_revno=None, date_merged=None, | 481 | def markAsMerged(self, merged_revno=None, date_merged=None, |
153 | 479 | merge_reporter=None): | 482 | merge_reporter=None): |
154 | 480 | """See `IBranchMergeProposal`.""" | 483 | """See `IBranchMergeProposal`.""" |
155 | 481 | 484 | ||
156 | === modified file 'lib/lp/code/model/tests/test_branchmergeproposals.py' | |||
157 | --- lib/lp/code/model/tests/test_branchmergeproposals.py 2010-03-30 09:56:10 +0000 | |||
158 | +++ lib/lp/code/model/tests/test_branchmergeproposals.py 2010-04-29 22:33:35 +0000 | |||
159 | @@ -117,7 +117,7 @@ | |||
160 | 117 | BranchMergeProposalStatus.CODE_APPROVED: 'approveBranch', | 117 | BranchMergeProposalStatus.CODE_APPROVED: 'approveBranch', |
161 | 118 | BranchMergeProposalStatus.REJECTED: 'rejectBranch', | 118 | BranchMergeProposalStatus.REJECTED: 'rejectBranch', |
162 | 119 | BranchMergeProposalStatus.MERGED: 'markAsMerged', | 119 | BranchMergeProposalStatus.MERGED: 'markAsMerged', |
164 | 120 | BranchMergeProposalStatus.MERGE_FAILED: 'mergeFailed', | 120 | BranchMergeProposalStatus.MERGE_FAILED: 'setStatus', |
165 | 121 | BranchMergeProposalStatus.QUEUED: 'enqueue', | 121 | BranchMergeProposalStatus.QUEUED: 'enqueue', |
166 | 122 | BranchMergeProposalStatus.SUPERSEDED: 'resubmit', | 122 | BranchMergeProposalStatus.SUPERSEDED: 'resubmit', |
167 | 123 | } | 123 | } |
168 | @@ -135,17 +135,21 @@ | |||
169 | 135 | 135 | ||
170 | 136 | def _attemptTransition(self, proposal, to_state): | 136 | def _attemptTransition(self, proposal, to_state): |
171 | 137 | """Try to transition the proposal into the state `to_state`.""" | 137 | """Try to transition the proposal into the state `to_state`.""" |
172 | 138 | kwargs = {} | ||
173 | 138 | method = getattr(proposal, self.transition_functions[to_state]) | 139 | method = getattr(proposal, self.transition_functions[to_state]) |
174 | 139 | if to_state in (BranchMergeProposalStatus.CODE_APPROVED, | 140 | if to_state in (BranchMergeProposalStatus.CODE_APPROVED, |
175 | 140 | BranchMergeProposalStatus.REJECTED, | 141 | BranchMergeProposalStatus.REJECTED, |
176 | 141 | BranchMergeProposalStatus.QUEUED): | 142 | BranchMergeProposalStatus.QUEUED): |
177 | 142 | args = [proposal.target_branch.owner, 'some_revision_id'] | 143 | args = [proposal.target_branch.owner, 'some_revision_id'] |
180 | 143 | elif to_state in (BranchMergeProposalStatus.MERGE_FAILED, | 144 | elif to_state in (BranchMergeProposalStatus.SUPERSEDED,): |
179 | 144 | BranchMergeProposalStatus.SUPERSEDED): | ||
181 | 145 | args = [proposal.registrant] | 145 | args = [proposal.registrant] |
182 | 146 | elif to_state in (BranchMergeProposalStatus.MERGE_FAILED,): | ||
183 | 147 | # transition via setStatus. | ||
184 | 148 | args = [to_state] | ||
185 | 149 | kwargs = dict(user=proposal.target_branch.owner) | ||
186 | 146 | else: | 150 | else: |
187 | 147 | args = [] | 151 | args = [] |
189 | 148 | method(*args) | 152 | method(*args, **kwargs) |
190 | 149 | 153 | ||
191 | 150 | def assertGoodTransition(self, from_state, to_state): | 154 | def assertGoodTransition(self, from_state, to_state): |
192 | 151 | """Assert that we can go from `from_state` to `to_state`.""" | 155 | """Assert that we can go from `from_state` to `to_state`.""" |
193 | @@ -267,6 +271,20 @@ | |||
194 | 267 | """We can go from merge failed to any other state.""" | 271 | """We can go from merge failed to any other state.""" |
195 | 268 | self.assertAllTransitionsGood(BranchMergeProposalStatus.MERGE_FAILED) | 272 | self.assertAllTransitionsGood(BranchMergeProposalStatus.MERGE_FAILED) |
196 | 269 | 273 | ||
197 | 274 | def test_transition_from_merge_failed_to_queued_non_reviewer(self): | ||
198 | 275 | # Contributors can requeue to retry after environmental issues fail a | ||
199 | 276 | # merge. | ||
200 | 277 | proposal = self.factory.makeBranchMergeProposal() | ||
201 | 278 | self.assertFalse(proposal.target_branch.isPersonTrustedReviewer( | ||
202 | 279 | proposal.source_branch.owner)) | ||
203 | 280 | self.assertValidTransitions(set([ | ||
204 | 281 | BranchMergeProposalStatus.MERGE_FAILED, | ||
205 | 282 | BranchMergeProposalStatus.CODE_APPROVED, | ||
206 | 283 | # It is always valid to go to the same state. | ||
207 | 284 | BranchMergeProposalStatus.QUEUED]), | ||
208 | 285 | proposal, BranchMergeProposalStatus.QUEUED, | ||
209 | 286 | proposal.source_branch.owner) | ||
210 | 287 | |||
211 | 270 | def test_transitions_from_queued_dequeue(self): | 288 | def test_transitions_from_queued_dequeue(self): |
212 | 271 | # When a proposal is dequeued it is set to code approved, and the | 289 | # When a proposal is dequeued it is set to code approved, and the |
213 | 272 | # queue position is reset. | 290 | # queue position is reset. |
214 | @@ -298,11 +316,25 @@ | |||
215 | 298 | proposal = self.factory.makeBranchMergeProposal( | 316 | proposal = self.factory.makeBranchMergeProposal( |
216 | 299 | target_branch=self.target_branch, | 317 | target_branch=self.target_branch, |
217 | 300 | set_state=BranchMergeProposalStatus.QUEUED) | 318 | set_state=BranchMergeProposalStatus.QUEUED) |
219 | 301 | proposal.mergeFailed(None) | 319 | proposal.setStatus(BranchMergeProposalStatus.MERGE_FAILED) |
220 | 302 | self.assertProposalState( | 320 | self.assertProposalState( |
221 | 303 | proposal, BranchMergeProposalStatus.MERGE_FAILED) | 321 | proposal, BranchMergeProposalStatus.MERGE_FAILED) |
222 | 304 | self.assertIs(None, proposal.queue_position) | 322 | self.assertIs(None, proposal.queue_position) |
223 | 305 | 323 | ||
224 | 324 | def test_transition_to_merge_failed_non_reviewer(self): | ||
225 | 325 | # non reviewers cannot set merge-failed (target branch owners are | ||
226 | 326 | # implicitly reviewers). | ||
227 | 327 | proposal = self.factory.makeBranchMergeProposal() | ||
228 | 328 | self.assertFalse(proposal.target_branch.isPersonTrustedReviewer( | ||
229 | 329 | proposal.source_branch.owner)) | ||
230 | 330 | self.assertValidTransitions(set([ | ||
231 | 331 | # It is always valid to go to the same state. | ||
232 | 332 | BranchMergeProposalStatus.MERGE_FAILED, | ||
233 | 333 | BranchMergeProposalStatus.CODE_APPROVED, | ||
234 | 334 | BranchMergeProposalStatus.QUEUED]), | ||
235 | 335 | proposal, BranchMergeProposalStatus.MERGE_FAILED, | ||
236 | 336 | proposal.source_branch.owner) | ||
237 | 337 | |||
238 | 306 | def test_transitions_to_wip_resets_reviewer(self): | 338 | def test_transitions_to_wip_resets_reviewer(self): |
239 | 307 | # When a proposal was approved and is moved back into work in progress | 339 | # When a proposal was approved and is moved back into work in progress |
240 | 308 | # the reviewer, date reviewed, and reviewed revision are all reset. | 340 | # the reviewer, date reviewed, and reviewed revision are all reset. |
241 | @@ -328,6 +360,19 @@ | |||
242 | 328 | self.target_branch = self.factory.makeProductBranch() | 360 | self.target_branch = self.factory.makeProductBranch() |
243 | 329 | login_person(self.target_branch.owner) | 361 | login_person(self.target_branch.owner) |
244 | 330 | 362 | ||
245 | 363 | def test_set_status_approved_to_queued(self): | ||
246 | 364 | # setState can change an approved merge proposal to Work In Progress, | ||
247 | 365 | # which will set the revision id to the reviewed revision id if not | ||
248 | 366 | # supplied. | ||
249 | 367 | proposal = self.factory.makeBranchMergeProposal( | ||
250 | 368 | target_branch=self.target_branch, | ||
251 | 369 | set_state=BranchMergeProposalStatus.CODE_APPROVED) | ||
252 | 370 | proposal.approveBranch(proposal.target_branch.owner, '250') | ||
253 | 371 | proposal.setStatus(BranchMergeProposalStatus.QUEUED) | ||
254 | 372 | self.assertEqual(proposal.queue_status, | ||
255 | 373 | BranchMergeProposalStatus.QUEUED) | ||
256 | 374 | self.assertEqual(proposal.queued_revision_id, '250') | ||
257 | 375 | |||
258 | 331 | def test_set_status_approved_to_work_in_progress(self): | 376 | def test_set_status_approved_to_work_in_progress(self): |
259 | 332 | # setState can change an approved merge proposal to Work In Progress. | 377 | # setState can change an approved merge proposal to Work In Progress. |
260 | 333 | proposal = self.factory.makeBranchMergeProposal( | 378 | proposal = self.factory.makeBranchMergeProposal( |
261 | @@ -337,6 +382,18 @@ | |||
262 | 337 | self.assertEqual(proposal.queue_status, | 382 | self.assertEqual(proposal.queue_status, |
263 | 338 | BranchMergeProposalStatus.WORK_IN_PROGRESS) | 383 | BranchMergeProposalStatus.WORK_IN_PROGRESS) |
264 | 339 | 384 | ||
265 | 385 | def test_set_status_queued_to_merge_failed(self): | ||
266 | 386 | proposal = self.factory.makeBranchMergeProposal( | ||
267 | 387 | target_branch=self.target_branch, | ||
268 | 388 | set_state=BranchMergeProposalStatus.QUEUED) | ||
269 | 389 | proposal.setStatus(BranchMergeProposalStatus.MERGE_FAILED) | ||
270 | 390 | self.assertEqual(proposal.queue_status, | ||
271 | 391 | BranchMergeProposalStatus.MERGE_FAILED) | ||
272 | 392 | self.assertEqual(proposal.queuer, None) | ||
273 | 393 | self.assertEqual(proposal.queued_revision_id, None) | ||
274 | 394 | self.assertEqual(proposal.date_queued, None) | ||
275 | 395 | self.assertEqual(proposal.queue_position, None) | ||
276 | 396 | |||
277 | 340 | def test_set_status_wip_to_needs_review(self): | 397 | def test_set_status_wip_to_needs_review(self): |
278 | 341 | # setState can change the merge proposal to Needs Review. | 398 | # setState can change the merge proposal to Needs Review. |
279 | 342 | proposal = self.factory.makeBranchMergeProposal( | 399 | proposal = self.factory.makeBranchMergeProposal( |
280 | 343 | 400 | ||
281 | === modified file 'lib/lp/testing/factory.py' | |||
282 | --- lib/lp/testing/factory.py 2010-04-26 15:02:03 +0000 | |||
283 | +++ lib/lp/testing/factory.py 2010-04-29 22:33:35 +0000 | |||
284 | @@ -958,7 +958,7 @@ | |||
285 | 958 | elif set_state == BranchMergeProposalStatus.MERGED: | 958 | elif set_state == BranchMergeProposalStatus.MERGED: |
286 | 959 | unsafe_proposal.markAsMerged() | 959 | unsafe_proposal.markAsMerged() |
287 | 960 | elif set_state == BranchMergeProposalStatus.MERGE_FAILED: | 960 | elif set_state == BranchMergeProposalStatus.MERGE_FAILED: |
289 | 961 | unsafe_proposal.mergeFailed(proposal.target_branch.owner) | 961 | unsafe_proposal.setStatus(set_state, proposal.target_branch.owner) |
290 | 962 | elif set_state == BranchMergeProposalStatus.QUEUED: | 962 | elif set_state == BranchMergeProposalStatus.QUEUED: |
291 | 963 | unsafe_proposal.commit_message = self.getUniqueString( | 963 | unsafe_proposal.commit_message = self.getUniqueString( |
292 | 964 | 'commit message') | 964 | 'commit message') |
lib/lp/ code/interfaces /branchmergepro posal.py
- change needs indenting a space
actually your indentation is all over the place in the tests too (so says the diff)
setStatus should call mergeFailed, and pass in the revision id
should also have a test where you can call setStatus for queued and pass in a revision id