launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03169
[Merge] lp:~stevenk/launchpad/dsd-dont-request-child-diff into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/dsd-dont-request-child-diff into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/dsd-dont-request-child-diff/+merge/55863
Building on the work started in https://code.launchpad.net/~stevenk/launchpad/dsd-hide-child-diff/+merge/55685, this branch handles the backend case, by not even requesting a diff if the child has the base version as its latest version.
--
https://code.launchpad.net/~stevenk/launchpad/dsd-dont-request-child-diff/+merge/55863
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/dsd-dont-request-child-diff into lp:launchpad.
=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py 2011-03-30 01:57:27 +0000
+++ lib/lp/registry/model/distroseriesdifference.py 2011-04-01 04:20:48 +0000
@@ -403,7 +403,8 @@
base_spr = self.base_source_pub.sourcepackagerelease
derived_spr = self.source_pub.sourcepackagerelease
parent_spr = self.parent_source_pub.sourcepackagerelease
- self.package_diff = base_spr.requestDiffTo(
- requestor, to_sourcepackagerelease=derived_spr)
+ if self.source_version != self.base_version:
+ self.package_diff = base_spr.requestDiffTo(
+ requestor, to_sourcepackagerelease=derived_spr)
self.parent_package_diff = base_spr.requestDiffTo(
requestor, to_sourcepackagerelease=parent_spr)
=== modified file 'lib/lp/registry/tests/test_distroseriesdifference.py'
--- lib/lp/registry/tests/test_distroseriesdifference.py 2011-03-30 01:57:27 +0000
+++ lib/lp/registry/tests/test_distroseriesdifference.py 2011-04-01 04:20:48 +0000
@@ -602,6 +602,28 @@
self.assertEqual(
'1.0', ds_diff.parent_package_diff.from_source.version)
+ def test_requestPackageDiffs_child_is_base(self):
+ # When the child has the same version as the base version, when
+ # diffs are requested, child diffs aren't.
+ dervied_changelog = self.factory.makeChangelog(versions=['0.1-1'])
+ parent_changelog = self.factory.makeChangelog(
+ versions=['0.1-2', '0.1-1'])
+ transaction.commit() # Yay, librarian.
+ ds_diff = self.factory.makeDistroSeriesDifference(versions={
+ 'derived': '0.1-1',
+ 'parent': '0.1-2',
+ 'base': '0.1-1',
+ },
+ changelogs={
+ 'derived': dervied_changelog,
+ 'parent': parent_changelog,
+ })
+
+ with person_logged_in(ds_diff.owner):
+ ds_diff.requestPackageDiffs(ds_diff.owner)
+ self.assertIs(None, ds_diff.package_diff)
+ self.assertIsNot(None, ds_diff.parent_package_diff)
+
def test_package_diff_urls_none(self):
# URLs to the package diffs are only present when the diffs
# have been generated.