Merge lp:~mwhudson/launchpad/delete-package-branch-link-pocket-bug-387554 into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/delete-package-branch-link-pocket-bug-387554
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~mwhudson/launchpad/delete-package-branch-link-pocket-bug-387554
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+9610@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi,

I think this branch fixes bug 387554, although I think the description of this bug is a bit wrong.

See https://bugs.edge.launchpad.net/launchpad-code/+bug/387554/comments/10 for more.

Cheers,
mwh

Revision history for this message
Tim Penhey (thumper) wrote :

You are good to land :-)

Thanks for tracking this down.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/model/seriessourcepackagebranch.py'
2--- lib/lp/code/model/seriessourcepackagebranch.py 2009-07-17 00:26:05 +0000
3+++ lib/lp/code/model/seriessourcepackagebranch.py 2009-08-04 02:54:15 +0000
4@@ -131,4 +131,5 @@
5 SeriesSourcePackageBranch,
6 SeriesSourcePackageBranch.distroseries == distroseries.id,
7 SeriesSourcePackageBranch.sourcepackagename ==
8- sourcepackagename.id).remove()
9+ sourcepackagename.id,
10+ SeriesSourcePackageBranch.pocket == pocket).remove()
11
12=== modified file 'lib/lp/code/model/tests/test_seriessourcepackagebranch.py'
13--- lib/lp/code/model/tests/test_seriessourcepackagebranch.py 2009-07-17 02:25:09 +0000
14+++ lib/lp/code/model/tests/test_seriessourcepackagebranch.py 2009-08-04 02:54:41 +0000
15@@ -22,7 +22,6 @@
16 def setUp(self):
17 TestCaseWithFactory.setUp(self)
18 self.link_set = SeriesSourcePackageBranchSet()
19- self.distro = self.factory.makeDistribution()
20
21 def makeLinkedPackageBranch(self, distribution, sourcepackagename):
22 """Make a new package branch and make it official."""
23@@ -50,19 +49,42 @@
24 b2 = self.makeLinkedPackageBranch(distribution, sourcepackagename)
25
26 # Make one more on same source package on different distro.
27- b3 = self.makeLinkedPackageBranch(None, sourcepackagename)
28+ self.makeLinkedPackageBranch(None, sourcepackagename)
29
30 # Make one more on different source package, same different distro.
31- b4 = self.makeLinkedPackageBranch(distribution, None)
32+ self.makeLinkedPackageBranch(distribution, None)
33
34 # And one more unrelated linked package branch.
35- b5 = self.makeLinkedPackageBranch(None, None)
36+ self.makeLinkedPackageBranch(None, None)
37
38 links = self.link_set.findForDistributionSourcePackage(
39 distro_source_package)
40 self.assertEqual(
41 sorted([b1, b2]), sorted([link.branch for link in links]))
42
43+ def test_delete(self):
44+ # SeriesSourcePackageBranchSet.delete removes the link between a
45+ # particular branch and a (distro_series, pocket, sourcepackagename)
46+ # tupled.
47+ distro_series = self.factory.makeDistroRelease()
48+ sourcepackagename = self.factory.makeSourcePackageName()
49+ sourcepackage = self.factory.makeSourcePackage(
50+ sourcepackagename=sourcepackagename, distroseries=distro_series)
51+ branch_release = self.factory.makePackageBranch(
52+ distroseries=distro_series, sourcepackagename=sourcepackagename)
53+ branch_updates = self.factory.makePackageBranch(
54+ distroseries=distro_series, sourcepackagename=sourcepackagename)
55+ self.link_set.new(
56+ distro_series, PackagePublishingPocket.RELEASE, sourcepackagename,
57+ branch_release, branch_release.owner)
58+ self.link_set.new(
59+ distro_series, PackagePublishingPocket.UPDATES, sourcepackagename,
60+ branch_updates, branch_updates.owner)
61+ self.link_set.delete(sourcepackage, PackagePublishingPocket.UPDATES)
62+ links = self.link_set.findForSourcePackage(sourcepackage)
63+ self.assertEqual(
64+ sorted([branch_release]), sorted([link.branch for link in links]))
65+
66
67 def test_suite():
68 return unittest.TestLoader().loadTestsFromName(__name__)