← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/copy-explicit-pocket-2 into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/copy-explicit-pocket-2 into lp:launchpad.

Commit message:
Look up Archive.copyPackage from_series parameter in the correct distribution.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1070324 in Launchpad itself: "Incremental copying of binaries doesn't work due to lack of explicit series/pocket selection"
  https://bugs.launchpad.net/launchpad/+bug/1070324

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/copy-explicit-pocket-2/+merge/131145

Follow-up fix to https://code.launchpad.net/~cjwatson/launchpad/copy-explicit-pocket/+merge/131002, fixing a bug noticed by William Grant that the from_series parameter was looked up in the target distribution rather than the source distribution.
-- 
https://code.launchpad.net/~cjwatson/launchpad/copy-explicit-pocket-2/+merge/131145
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/copy-explicit-pocket-2 into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2012-10-23 12:36:50 +0000
+++ lib/lp/soyuz/model/archive.py	2012-10-24 09:30:36 +0000
@@ -1675,7 +1675,8 @@
         if from_pocket:
             from_pocket = self._text_to_pocket(from_pocket)
         if from_series:
-            from_series = self._text_to_series(from_series)
+            from_series = self._text_to_series(
+                from_series, distribution=from_archive.distribution)
         # Upload permission checks, this will raise CannotCopy as
         # necessary.
         source = self._validateAndFindSource(

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2012-10-23 12:36:50 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2012-10-24 09:30:36 +0000
@@ -2155,11 +2155,13 @@
 
     layer = DatabaseFunctionalLayer
 
-    def _setup_copy_data(self, source_private=False, target_purpose=None,
+    def _setup_copy_data(self, source_distribution=None, source_private=False,
+                         target_purpose=None,
                          target_status=SeriesStatus.DEVELOPMENT):
         if target_purpose is None:
             target_purpose = ArchivePurpose.PPA
-        source_archive = self.factory.makeArchive(private=source_private)
+        source_archive = self.factory.makeArchive(
+            distribution=source_distribution, private=source_private)
         target_archive = self.factory.makeArchive(purpose=target_purpose)
         source = self.factory.makeSourcePackagePublishingHistory(
             archive=source_archive, status=PackagePublishingStatus.PUBLISHED)
@@ -2378,7 +2380,8 @@
         # The from_series and from_pocket parameters cause copyPackage to
         # select a matching source publication.
         (source, source_archive, source_name, target_archive, to_pocket,
-         to_series, version) = self._setup_copy_data()
+         to_series, version) = self._setup_copy_data(
+            source_distribution=self.factory.makeDistribution())
         other_series = self.factory.makeDistroSeries(
             distribution=source_archive.distribution,
             status=SeriesStatus.DEVELOPMENT)


Follow ups