← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/more-diff-update-msg into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #525698 MP diff update message should be shown before scanning
  https://bugs.launchpad.net/bugs/525698


= 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
-- 
https://code.launchpad.net/~abentley/launchpad/more-diff-update-msg/+merge/44288
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/more-diff-update-msg into lp:launchpad.
=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
--- lib/lp/code/browser/branchmergeproposal.py	2010-12-01 11:26:57 +0000
+++ lib/lp/code/browser/branchmergeproposal.py	2010-12-20 21:18:53 +0000
@@ -665,7 +665,9 @@
 
     @property
     def pending_diff(self):
-        return self.context.next_preview_diff_job is not None
+        return (
+            self.context.next_preview_diff_job is not None or
+            self.context.source_branch.pending_writes)
 
     @cachedproperty
     def preview_diff(self):

=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py	2010-12-01 11:26:57 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py	2010-12-20 21:18:53 +0000
@@ -782,6 +782,16 @@
         self.assertTrue(view.conversation.comments[1].from_superseded)
         self.assertTrue(view.conversation.comments[0].from_superseded)
 
+    def test_pending_diff_with_pending_branch(self):
+        bmp = self.factory.makeBranchMergeProposal()
+        bmp.next_preview_diff_job.start()
+        bmp.next_preview_diff_job.fail()
+        view = create_initialized_view(bmp, '+index')
+        self.assertFalse(view.pending_diff)
+        with person_logged_in(bmp.source_branch.owner):
+            bmp.target_branch.branchChanged(None, 'rev-1', None, None, None)
+        self.assertTrue(view.pending_diff)
+
 
 class TestBranchMergeProposalChangeStatusOptions(TestCaseWithFactory):
     """Test the status vocabulary generated for then +edit-status view."""