launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03215
[Merge] lp:~rvb/launchpad/dds-add-unique-packages into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/dds-add-unique-packages into lp:launchpad with lp:~rvb/launchpad/dds-add-missingpackages-page2 as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #752397 in Launchpad itself: "Create a +uniquepackages page for derived distroseries."
https://bugs.launchpad.net/launchpad/+bug/752397
For more details, see:
https://code.launchpad.net/~rvb/launchpad/dds-add-unique-packages/+merge/56548
This branch adds a page (+uniquepackages) to interact with packages in the derived series but not in the parent series.
== Tests ==
./bin/test -cvv test_series_views test_uniquepackages_differences
./bin/test -cvv test_series_views test_uniquepackages_differences_empty
./bin/test -cvv test_series_views test_packagesets_uniquepackages
== QA ==
- Turn on the feature flag :
'soyuz.derived-series-ui.enabled default 1 on'
- Modify the differences in the sample dataset:
update distroseriesdifference set status=1;
- Check out the page:
https://launchpad.dev/deribuntu/deriwarty/+uniquepackages
(not much to do here, except click on 'Update' to reload the page and make
sure the differences are properly displayed)
--
https://code.launchpad.net/~rvb/launchpad/dds-add-unique-packages/+merge/56548
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/dds-add-unique-packages into lp:launchpad.
=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml 2011-04-06 11:16:38 +0000
+++ lib/lp/registry/browser/configure.zcml 2011-04-06 11:16:38 +0000
@@ -160,6 +160,12 @@
template="../templates/distroseries-localdifferences.pt"
permission="zope.Public"/>
<browser:page
+ name="+uniquepackages"
+ for="lp.registry.interfaces.distroseries.IDistroSeries"
+ class="lp.registry.browser.distroseries.DistroSeriesUniquePackages"
+ template="../templates/distroseries-localdifferences.pt"
+ permission="zope.Public"/>
+ <browser:page
name="+localpackagediffs"
for="lp.registry.interfaces.distroseries.IDistroSeries"
class="lp.registry.browser.distroseries.DistroSeriesLocalDifferences"
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py 2011-04-06 11:16:38 +0000
+++ lib/lp/registry/browser/distroseries.py 2011-04-06 11:16:38 +0000
@@ -949,3 +949,42 @@
condition='canPerformSync')
def sync_sources(self, action, data):
self._sync_sources(action, data)
+
+
+class DistroSeriesUniquePackages(DistroSeriesDifferenceBase,
+ LaunchpadFormView):
+ """Present differences of type UNIQUE_TO_DERIVED_SERIES between
+ a derived series and its parent.
+ """
+ page_title = 'Unique packages'
+ differences_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
+ show_parent_version = False
+ show_package_diffs = False
+ show_packagesets = True
+
+ def initialize(self):
+ super(DistroSeriesUniquePackages, self).initialize()
+
+ @property
+ def explanation(self):
+ return structured(
+ "Packages that are listed here are those that have been added to "
+ "%s but are not yet part of the parent series %s.",
+ self.context.displayname,
+ self.context.parent_series.displayname)
+
+ @property
+ def label(self):
+ return (
+ "Packages in '%s' but not in parent series '%s'" % (
+ self.context.displayname,
+ self.context.parent_series.displayname,
+ ))
+
+ @action(_("Update"), name="update")
+ def update_action(self, action, data):
+ """Simply re-issue the form with the new values."""
+ pass
+
+ def canPerformSync(self, *args):
+ return False
=== modified file 'lib/lp/registry/browser/tests/test_series_views.py'
--- lib/lp/registry/browser/tests/test_series_views.py 2011-04-06 11:16:38 +0000
+++ lib/lp/registry/browser/tests/test_series_views.py 2011-04-06 11:16:38 +0000
@@ -809,6 +809,90 @@
html, packageset_text, 'parent-packagesets', 'Parent packagesets')
+class DistroSerieUniquePackageDiffsTestCase(TestCaseWithFactory):
+ """Test the distroseries +uniquepackages view."""
+
+ layer = LaunchpadZopelessLayer
+
+ def test_uniquepackages_differences(self):
+ # The view fetches the differences with type
+ # UNIQUE_TO_DERIVED_SERIES.
+ derived_series = self.factory.makeDistroSeries(
+ name='derilucid', parent_series=self.factory.makeDistroSeries(
+ name='lucid'))
+
+ missing_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
+ missing_blacklisted_diff = self.factory.makeDistroSeriesDifference(
+ difference_type=missing_type,
+ derived_series=derived_series,
+ status=DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT)
+
+ missing_diff = self.factory.makeDistroSeriesDifference(
+ difference_type=missing_type,
+ derived_series=derived_series,
+ status=DistroSeriesDifferenceStatus.NEEDS_ATTENTION)
+
+ view = create_initialized_view(
+ derived_series, '+uniquepackages')
+
+ self.assertContentEqual(
+ [missing_diff], view.cached_differences.batch)
+
+ def test_uniquepackages_differences_empty(self):
+ # The view is empty if there is no differences with type
+ # UNIQUE_TO_DERIVED_SERIES.
+ derived_series = self.factory.makeDistroSeries(
+ parent_series=self.factory.makeDistroSeries())
+
+ not_missing_type = DistroSeriesDifferenceType.DIFFERENT_VERSIONS
+
+ missing_diff = self.factory.makeDistroSeriesDifference(
+ difference_type=not_missing_type,
+ derived_series=derived_series,
+ status=DistroSeriesDifferenceStatus.NEEDS_ATTENTION)
+
+ view = create_initialized_view(
+ derived_series, '+uniquepackages')
+
+ self.assertContentEqual(
+ [], view.cached_differences.batch)
+
+
+class DistroSeriesUniquePackagesPageTestCase(DistroSeriesDifferenceMixin,
+ TestCaseWithFactory):
+ """Test the distroseries +uniquepackages page."""
+
+ layer = DatabaseFunctionalLayer
+
+ def setUp(self):
+ super(DistroSeriesUniquePackagesPageTestCase,
+ self).setUp('foo.bar@xxxxxxxxxxxxx')
+ set_derived_series_ui_feature_flag(self)
+ self.simple_user = self.factory.makePerson()
+
+ def test_packagesets_uniquepackages(self):
+ # +uniquepackages displays the packagesets in the parent.
+ missing_type = DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES
+ self.ds_diff = self.factory.makeDistroSeriesDifference(
+ difference_type=missing_type)
+
+ with celebrity_logged_in('admin'):
+ ps = self.factory.makePackageset(
+ packages=[self.ds_diff.source_package_name],
+ distroseries=self.ds_diff.derived_series)
+
+ with person_logged_in(self.simple_user):
+ view = create_initialized_view(
+ self.ds_diff.derived_series,
+ '+uniquepackages',
+ principal=self.simple_user)
+ html = view()
+
+ packageset_text = re.compile('\s*' + ps.name)
+ self._test_packagesets(
+ html, packageset_text, 'packagesets', 'Packagesets')
+
+
class TestMilestoneBatchNavigatorAttribute(TestCaseWithFactory):
"""Test the series.milestone_batch_navigator attribute."""
=== modified file 'lib/lp/registry/templates/distroseries-localdifferences.pt'
--- lib/lp/registry/templates/distroseries-localdifferences.pt 2011-04-06 11:16:38 +0000
+++ lib/lp/registry/templates/distroseries-localdifferences.pt 2011-04-06 11:16:38 +0000
@@ -61,7 +61,7 @@
<tr tal:define="parent_source_pub difference/parent_source_pub;
source_pub difference/source_pub;
src_name difference/source_package_name/name;"
- tal:attributes="class parent_source_pub/source_package_name">
+ tal:attributes="class src_name">
<td>
<input tal:condition="view/canPerformSync"
name="field.selected_differences" type="checkbox"
@@ -70,7 +70,7 @@
id string:field.selected_differences.${src_name}"/>
<a tal:attributes="href difference/fmt:url" class="toggle-extra"
- tal:content="parent_source_pub/source_package_name">Foo</a>
+ tal:content="src_name">Foo</a>
</td>
<td tal:condition="view/show_parent_version">
<a tal:condition="difference/parent_source_package_release"