launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03342
[Merge] lp:~rvb/launchpad/fix-multiple-pending into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/fix-multiple-pending into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #761656 in Launchpad itself: "Fix source_package_release and parent_source_package_release method to handle the case where multiple pending publications are present."
https://bugs.launchpad.net/launchpad/+bug/761656
For more details, see:
https://code.launchpad.net/~rvb/launchpad/fix-multiple-pending/+merge/57855
This branch fixes DSD.source_package_release and DSD.parent_source_package_release methods to handle the case where multiple PENDING publishings are present. We return the most recent one.
= Tests =
./bin/test -cvv test_distroseriesdifference test_multiple_pending_publications_parent
./bin/test -cvv test_distroseriesdifference test_multiple_pending_publications
= QA =
The page +localpackagediffs (https://dogfood.launchpad.net/ubuntu/natty/+localpackagediffs)
a) won't oops.
b) will show links to the most recent publishings when many PENDING publication for the same version of a package are available.
--
https://code.launchpad.net/~rvb/launchpad/fix-multiple-pending/+merge/57855
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/fix-multiple-pending into lp:launchpad.
=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py 2011-04-13 14:44:31 +0000
+++ lib/lp/registry/model/distroseriesdifference.py 2011-04-15 11:49:31 +0000
@@ -322,8 +322,9 @@
distroseries=distro_series,
exact_match=True)
- # There is only one or zero published package.
- pub = IResultSet(pubs).one()
+ # Get the most recent publication (pubs are ordered by
+ # order is (name, id)).
+ pub = IResultSet(pubs).first()
if pub is None:
return None
else:
=== modified file 'lib/lp/registry/tests/test_distroseriesdifference.py'
--- lib/lp/registry/tests/test_distroseriesdifference.py 2011-04-14 20:06:33 +0000
+++ lib/lp/registry/tests/test_distroseriesdifference.py 2011-04-15 11:49:31 +0000
@@ -707,6 +707,50 @@
self.assertEqual(ds_diff.source_package_release.version, '1.4')
self.assertEqual(ds_diff.parent_source_package_release.version, '1.5')
+ def test_multiple_pending_publications_derived(self):
+ # If multiple (PENDING) publications are present in the derived
+ # series, the most recent is returned.
+ ds_diff = self.factory.makeDistroSeriesDifference(
+ versions={
+ 'derived': '1.0',
+ })
+ self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=ds_diff.source_package_name,
+ distroseries=ds_diff.derived_series,
+ status=PackagePublishingStatus.PENDING,
+ version='1.0')
+ pub = self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=ds_diff.source_package_name,
+ distroseries=ds_diff.derived_series,
+ status=PackagePublishingStatus.PENDING,
+ version='1.0')
+
+ self.assertEqual(
+ pub,
+ ds_diff.source_package_release.publishings[0])
+
+ def test_multiple_pending_publications_parent(self):
+ # If multiple (PENDING) publications are present in the parent
+ # series, the most recent is returned.
+ ds_diff = self.factory.makeDistroSeriesDifference(
+ versions={
+ 'parent': '1.0',
+ })
+ self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=ds_diff.source_package_name,
+ distroseries=ds_diff.derived_series.parent_series,
+ status=PackagePublishingStatus.PENDING,
+ version='1.0')
+ pub = self.factory.makeSourcePackagePublishingHistory(
+ sourcepackagename=ds_diff.source_package_name,
+ distroseries=ds_diff.derived_series.parent_series,
+ status=PackagePublishingStatus.PENDING,
+ version='1.0')
+
+ self.assertEqual(
+ pub,
+ ds_diff.parent_source_package_release.publishings[0])
+
class DistroSeriesDifferenceLibrarianTestCase(TestCaseWithFactory):