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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merged at revision: 16184
Proposed branch: lp:~cjwatson/launchpad/copy-explicit-pocket-2
Merge into: lp:launchpad
Diff against target: 43 lines (+8/-4)
2 files modified
lib/lp/soyuz/model/archive.py (+2/-1)
lib/lp/soyuz/tests/test_archive.py (+6/-3)
To merge this branch: bzr merge lp:~cjwatson/launchpad/copy-explicit-pocket-2
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+131145@code.launchpad.net

Commit message

Look up Archive.copyPackage from_series parameter in the correct distribution.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/archive.py'
2--- lib/lp/soyuz/model/archive.py 2012-10-23 12:36:50 +0000
3+++ lib/lp/soyuz/model/archive.py 2012-10-24 09:32:19 +0000
4@@ -1675,7 +1675,8 @@
5 if from_pocket:
6 from_pocket = self._text_to_pocket(from_pocket)
7 if from_series:
8- from_series = self._text_to_series(from_series)
9+ from_series = self._text_to_series(
10+ from_series, distribution=from_archive.distribution)
11 # Upload permission checks, this will raise CannotCopy as
12 # necessary.
13 source = self._validateAndFindSource(
14
15=== modified file 'lib/lp/soyuz/tests/test_archive.py'
16--- lib/lp/soyuz/tests/test_archive.py 2012-10-23 12:36:50 +0000
17+++ lib/lp/soyuz/tests/test_archive.py 2012-10-24 09:32:19 +0000
18@@ -2155,11 +2155,13 @@
19
20 layer = DatabaseFunctionalLayer
21
22- def _setup_copy_data(self, source_private=False, target_purpose=None,
23+ def _setup_copy_data(self, source_distribution=None, source_private=False,
24+ target_purpose=None,
25 target_status=SeriesStatus.DEVELOPMENT):
26 if target_purpose is None:
27 target_purpose = ArchivePurpose.PPA
28- source_archive = self.factory.makeArchive(private=source_private)
29+ source_archive = self.factory.makeArchive(
30+ distribution=source_distribution, private=source_private)
31 target_archive = self.factory.makeArchive(purpose=target_purpose)
32 source = self.factory.makeSourcePackagePublishingHistory(
33 archive=source_archive, status=PackagePublishingStatus.PUBLISHED)
34@@ -2378,7 +2380,8 @@
35 # The from_series and from_pocket parameters cause copyPackage to
36 # select a matching source publication.
37 (source, source_archive, source_name, target_archive, to_pocket,
38- to_series, version) = self._setup_copy_data()
39+ to_series, version) = self._setup_copy_data(
40+ source_distribution=self.factory.makeDistribution())
41 other_series = self.factory.makeDistroSeries(
42 distribution=source_archive.distribution,
43 status=SeriesStatus.DEVELOPMENT)