← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/fix-package-diff-equal-versions into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/fix-package-diff-equal-versions into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #760691 in Launchpad itself: "On the +localpackagediffs page, the parent package diff icon should not be displayed if base_version is the same as parent_source_version."
  https://bugs.launchpad.net/launchpad/+bug/760691

For more details, see:
https://code.launchpad.net/~rvb/launchpad/fix-package-diff-equal-versions/+merge/57686

This branch fixes the UI on the +localpackagediffs page so that the parent package diff is not displayed if base_version==parent_source_version.

= Test =
./bin/test -cvv test_distroseriesdifference_views test_do_not_display_parent_diff

= QA =
- On the page:
    https://dogfood.launchpad.net/ubuntu/natty/+localpackagediffs
- Open the row for 'abakus'.
- Only one package diff line should be there. No line should go like this "0.91-1 to Sid version: 0.91-1".
-- 
https://code.launchpad.net/~rvb/launchpad/fix-package-diff-equal-versions/+merge/57686
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/fix-package-diff-equal-versions into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distroseriesdifference.py'
--- lib/lp/registry/browser/distroseriesdifference.py	2011-04-07 20:37:22 +0000
+++ lib/lp/registry/browser/distroseriesdifference.py	2011-04-14 14:04:18 +0000
@@ -162,6 +162,11 @@
         return self.context.source_version != self.context.base_version
 
     @property
+    def display_parent_diff(self):
+        """Only show the parent diff if we need to."""
+        return self.context.parent_source_version != self.context.base_version
+
+    @property
     def can_have_packages_diffs(self):
         """Return whether this dsd could have packages diffs."""
         diff_versions = DistroSeriesDifferenceType.DIFFERENT_VERSIONS

=== modified file 'lib/lp/registry/browser/tests/test_distroseriesdifference_views.py'
--- lib/lp/registry/browser/tests/test_distroseriesdifference_views.py	2011-04-07 20:37:22 +0000
+++ lib/lp/registry/browser/tests/test_distroseriesdifference_views.py	2011-04-14 14:04:18 +0000
@@ -209,6 +209,26 @@
         tags = soup.find('ul', 'package-diff-status').findAll('span')
         self.assertEqual(1, len(tags))
 
+    def test_do_not_display_parent_diff(self):
+        # If the parent's latest published version is the same as the base
+        # version, we don't display the link to the diff.
+        changelog_lfa = self.factory.makeChangelog('foo', ['0.30-1'])
+        parent_changelog_lfa = self.factory.makeChangelog(
+            'foo', ['0.32-1', '0.30-1'])
+        transaction.commit() # Yay, librarian.
+        ds_diff = self.factory.makeDistroSeriesDifference(versions={
+            'derived': '0.32-1',
+            'parent': '0.30-1',
+            }, changelogs={
+            'derived': changelog_lfa,
+            'parent': parent_changelog_lfa})
+
+        self.assertEqual('0.30-1', ds_diff.base_version)
+        view = create_initialized_view(ds_diff, '+listing-distroseries-extra')
+        soup = BeautifulSoup(view())
+        tags = soup.find('ul', 'package-diff-status').findAll('span')
+        self.assertEqual(1, len(tags))
+
     def _makeDistroSeriesDifferenceView(self, difference_type):
         # Helper method to create a view with the specified
         # difference_type.

=== modified file 'lib/lp/registry/templates/distroseriesdifference-listing-extra.pt'
--- lib/lp/registry/templates/distroseriesdifference-listing-extra.pt	2011-04-07 20:37:22 +0000
+++ lib/lp/registry/templates/distroseriesdifference-listing-extra.pt	2011-04-14 14:04:18 +0000
@@ -86,7 +86,7 @@
           </li>
         </tal:source-diff-option>
 
-        <tal:parent-diff-option condition="context/parent_source_pub">
+        <tal:parent-diff-option condition="view/display_parent_diff">
           <li tal:condition="context/parent_package_diff">
             <span tal:condition="context/parent_package_diff/status/enumvalue:PENDING"
               class="sprite PENDING parent">