Merge lp:~abentley/launchpad/more-diff-update-msg into lp:launchpad

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 12129
Proposed branch: lp:~abentley/launchpad/more-diff-update-msg
Merge into: lp:launchpad
Diff against target: 35 lines (+13/-1)
2 files modified
lib/lp/code/browser/branchmergeproposal.py (+3/-1)
lib/lp/code/browser/tests/test_branchmergeproposal.py (+10/-0)
To merge this branch: bzr merge lp:~abentley/launchpad/more-diff-update-msg
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+44288@code.launchpad.net

Commit message

[r=thumper][ui=none][bug=525698] Merge proposal diff update message shown when source updated.

Description of the change

= Summary =
Fix bug #525698: MP diff update message should be shown before scanning

== Proposed fix ==
Show the same message when the source branch needs scanning as when the diff is
being updated.

== Pre-implementation notes ==
None

== Implementation details ==
I simply updated the pending_diff property on the view.

Since the source branch is only considered to need scanning if the revision id
has changed, it is very likely that the diff will need an update if
pending_diff is true.

== Tests ==
bin/test -t test_pending_diff_with_pending_branch

== Demo and Q/A ==
Create a merge proposal. Commit a new revision and push to the source branch
immediately. The merge proposal should immediately show that the diff is being
updated.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/browser/tests/test_branchmergeproposal.py
  lib/lp/code/browser/branchmergeproposal.py

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
2--- lib/lp/code/browser/branchmergeproposal.py 2010-12-01 11:26:57 +0000
3+++ lib/lp/code/browser/branchmergeproposal.py 2010-12-21 04:44:48 +0000
4@@ -665,7 +665,9 @@
5
6 @property
7 def pending_diff(self):
8- return self.context.next_preview_diff_job is not None
9+ return (
10+ self.context.next_preview_diff_job is not None or
11+ self.context.source_branch.pending_writes)
12
13 @cachedproperty
14 def preview_diff(self):
15
16=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
17--- lib/lp/code/browser/tests/test_branchmergeproposal.py 2010-12-20 17:45:45 +0000
18+++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2010-12-21 04:44:48 +0000
19@@ -793,6 +793,16 @@
20 self.assertTrue(view.conversation.comments[1].from_superseded)
21 self.assertTrue(view.conversation.comments[0].from_superseded)
22
23+ def test_pending_diff_with_pending_branch(self):
24+ bmp = self.factory.makeBranchMergeProposal()
25+ bmp.next_preview_diff_job.start()
26+ bmp.next_preview_diff_job.fail()
27+ view = create_initialized_view(bmp, '+index')
28+ self.assertFalse(view.pending_diff)
29+ with person_logged_in(bmp.source_branch.owner):
30+ bmp.source_branch.branchChanged(None, 'rev-1', None, None, None)
31+ self.assertTrue(view.pending_diff)
32+
33
34 class TestBranchMergeProposalChangeStatusOptions(TestCaseWithFactory):
35 """Test the status vocabulary generated for then +edit-status view."""