launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03178
[Merge] lp:~stevenk/launchpad/dsd-cant-request-resolved into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/dsd-cant-request-resolved into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/dsd-cant-request-resolved/+merge/56097
If a DSD is in the resolved state, don't allow diffs to be requested -- since they'll be empty when they are generated.
--
https://code.launchpad.net/~stevenk/launchpad/dsd-cant-request-resolved/+merge/56097
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/dsd-cant-request-resolved into lp:launchpad.
=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py 2011-04-04 01:45:43 +0000
+++ lib/lp/registry/model/distroseriesdifference.py 2011-04-04 03:11:27 +0000
@@ -407,6 +407,9 @@
raise DistroSeriesDifferenceError(
"A derived, parent and base version are required to "
"generate package diffs.")
+ if self.status == DistroSeriesDifferenceStatus.RESOLVED:
+ raise DistroSeriesDifferenceError(
+ "Can not generate package diffs for a resolved difference.")
base_spr = self.base_source_pub.sourcepackagerelease
derived_spr = self.source_pub.sourcepackagerelease
parent_spr = self.parent_source_pub.sourcepackagerelease
=== modified file 'lib/lp/registry/tests/test_distroseriesdifference.py'
--- lib/lp/registry/tests/test_distroseriesdifference.py 2011-04-04 01:45:43 +0000
+++ lib/lp/registry/tests/test_distroseriesdifference.py 2011-04-04 03:11:27 +0000
@@ -22,7 +22,10 @@
DistroSeriesDifferenceStatus,
DistroSeriesDifferenceType,
)
-from lp.registry.errors import NotADerivedSeriesError
+from lp.registry.errors import (
+ DistroSeriesDifferenceError,
+ NotADerivedSeriesError,
+ )
from lp.registry.interfaces.distroseriesdifference import (
IDistroSeriesDifference,
IDistroSeriesDifferenceSource,
@@ -625,6 +628,27 @@
self.assertIs(None, ds_diff.package_diff)
self.assertIsNot(None, ds_diff.parent_package_diff)
+ def test_requestPackageDiffs_with_resolved_DSD(self):
+ # Diffs can't be requested for DSDs that are RESOLVED.
+ changelog_lfa = self.factory.makeChangelog(versions=['0.1-1'])
+ transaction.commit() # Yay, librarian.
+ ds_diff = self.factory.makeDistroSeriesDifference(
+ status=DistroSeriesDifferenceStatus.RESOLVED,
+ versions={
+ 'derived': '0.1-1',
+ 'parent': '0.1-1',
+ 'base': '0.1-1',
+ },
+ changelogs={
+ 'derived': changelog_lfa,
+ 'parent': changelog_lfa,
+ })
+ with person_logged_in(ds_diff.owner):
+ self.assertRaisesWithContent(
+ DistroSeriesDifferenceError,
+ "Can not generate package diffs for a resolved difference.",
+ ds_diff.requestPackageDiffs, ds_diff.owner)
+
def test_package_diff_urls_none(self):
# URLs to the package diffs are only present when the diffs
# have been generated.