← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/bug-817080 into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/bug-817080 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #817080 in Launchpad itself: "+uniquepackages should display the parent name."
  https://bugs.launchpad.net/launchpad/+bug/817080

For more details, see:
https://code.launchpad.net/~rvb/launchpad/bug-817080/+merge/69635

This branch adds the display of the parent for each DSD on the +uniquepackages page for a derived series with multiple parents.

= Tests =

./bin/test -vvc test_distroseries test_uniquepackages_displays_parent

= QA = 

- This page on DF should display the parent for each DSD: https://dogfood.launchpad.net/child1/series1/+uniquepackages
- This page on DF should *not* display the parent series (because the series has only one parent)
https://dogfood.launchpad.net/ubuntu/oneiric/+uniquepackages
-- 
https://code.launchpad.net/~rvb/launchpad/bug-817080/+merge/69635
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/bug-817080 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py	2011-07-20 16:51:49 +0000
+++ lib/lp/registry/browser/distroseries.py	2011-07-28 12:21:34 +0000
@@ -808,6 +808,7 @@
 
     # Differences type to display. Can be overrided by sublasses.
     differences_type = DistroSeriesDifferenceType.DIFFERENT_VERSIONS
+    show_parent = True
     show_parent_version = True
     show_derived_version = True
     show_package_diffs = True
@@ -1252,7 +1253,8 @@
     """
     page_title = 'Unique packages'
     differences_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
-    show_parent_version = False
+    show_parent = True
+    show_parent_version = False  # The DSDs are unique to the derived series.
     show_package_diffs = False
     show_packagesets = True
 

=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py	2011-07-25 11:56:30 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py	2011-07-28 12:21:34 +0000
@@ -2337,6 +2337,35 @@
         self.assertContentEqual(
             [missing_diff], view.cached_differences.batch)
 
+    def test_uniquepackages_displays_parent(self):
+        # For a series derived from multiple parents, the parent for each
+        # DSD is displayed; no parent version is displayed because we're
+        # listing packages unique to the derived series.
+        set_derived_series_ui_feature_flag(self)
+        derived_series, parent_series = self._createChildAndParents()
+        missing_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
+        self.factory.makeDistroSeriesDifference(
+            difference_type=missing_type,
+            derived_series=derived_series,
+            parent_series=parent_series,
+            status=DistroSeriesDifferenceStatus.NEEDS_ATTENTION)
+        view = create_initialized_view(
+            derived_series, '+uniquepackages')
+
+        multiple_parents_display_matcher = soupmatchers.HTMLContains(
+            soupmatchers.Tag(
+                "Parent table header", 'th',
+                text=re.compile("\s*Parent\s")),
+            Not(soupmatchers.Tag(
+                "Parent version table header", 'th',
+                text=re.compile("\s*Parent version\s*"))),
+            soupmatchers.Tag(
+                "Parent name", 'a',
+                attrs={'class': 'parent-name'},
+                text=re.compile("\s*%s\s*" % parent_series.displayname)),
+             )
+        self.assertThat(view.render(), multiple_parents_display_matcher)
+
     def test_uniquepackages_differences_empty(self):
         # The view is empty if there is no differences with type
         # UNIQUE_TO_DERIVED_SERIES.

=== modified file 'lib/lp/registry/templates/distroseries-localdifferences.pt'
--- lib/lp/registry/templates/distroseries-localdifferences.pt	2011-07-26 10:27:34 +0000
+++ lib/lp/registry/templates/distroseries-localdifferences.pt	2011-07-28 12:21:34 +0000
@@ -45,7 +45,7 @@
           <thead>
             <tr>
               <th>Source</th>
-              <th tal:condition="python: not(view.has_unique_parent) and view.show_parent_version">
+              <th tal:condition="python: not(view.has_unique_parent) and view.show_parent">
                 Parent
               </th>
               <th tal:condition="view/show_parent_version">
@@ -106,7 +106,7 @@
                   <span class="lowlight" tal:content="structure activity"></span>
                 </tal:activity>
               </td>
-              <td tal:condition="python: not(view.has_unique_parent) and view.show_parent_version">
+              <td tal:condition="python: not(view.has_unique_parent) and view.show_parent">
                 <a tal:attributes="href difference/parent_series/fmt:url"
                    tal:content="difference/parent_series/displayname"
                    class="parent-name">Warty</a>