Merge lp:~thumper/launchpad/branch-distro-set-old-mature into lp:launchpad

Proposed by Tim Penhey
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11590
Proposed branch: lp:~thumper/launchpad/branch-distro-set-old-mature
Merge into: lp:launchpad
Diff against target: 58 lines (+10/-2)
3 files modified
database/schema/security.cfg (+1/-1)
lib/lp/codehosting/branchdistro.py (+2/-1)
lib/lp/codehosting/tests/test_branchdistro.py (+7/-0)
To merge this branch: bzr merge lp:~thumper/launchpad/branch-distro-set-old-mature
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+36095@code.launchpad.net

Commit message

branch-distro.py now sets old branches as Mature.

Description of the change

Update the branch-distro script to set the old branches to Mature when creating the new ones.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

stuff

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/security.cfg'
2--- database/schema/security.cfg 2010-09-16 12:27:46 +0000
3+++ database/schema/security.cfg 2010-09-21 23:12:48 +0000
4@@ -628,7 +628,7 @@
5
6 [branch-distro]
7 type=user
8-public.branch = SELECT, INSERT
9+public.branch = SELECT, INSERT, UPDATE
10 public.branchsubscription = SELECT, INSERT
11 public.distribution = SELECT
12 public.distroseries = SELECT
13
14=== modified file 'lib/lp/codehosting/branchdistro.py'
15--- lib/lp/codehosting/branchdistro.py 2010-08-20 20:31:18 +0000
16+++ lib/lp/codehosting/branchdistro.py 2010-09-21 23:12:48 +0000
17@@ -28,7 +28,7 @@
18
19 from canonical.config import config
20 from canonical.launchpad.interfaces import ILaunchpadCelebrities
21-from lp.code.enums import BranchType
22+from lp.code.enums import BranchLifecycleStatus, BranchType
23 from lp.code.errors import BranchExists
24 from lp.code.interfaces.branchcollection import IAllBranches
25 from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
26@@ -341,6 +341,7 @@
27 new_db_branch.sourcepackage.setBranch(
28 PackagePublishingPocket.RELEASE, new_db_branch,
29 getUtility(ILaunchpadCelebrities).ubuntu_branches.teamowner)
30+ old_db_branch.lifecycle_status = BranchLifecycleStatus.MATURE
31 # switch_branches *moves* the data to locations dependent on the
32 # new_branch's id, so if the transaction was rolled back we wouldn't
33 # know the branch id and thus wouldn't be able to find the branch data
34
35=== modified file 'lib/lp/codehosting/tests/test_branchdistro.py'
36--- lib/lp/codehosting/tests/test_branchdistro.py 2010-08-20 20:31:18 +0000
37+++ lib/lp/codehosting/tests/test_branchdistro.py 2010-09-21 23:12:48 +0000
38@@ -34,6 +34,7 @@
39 QuietFakeLogger,
40 )
41 from canonical.testing.layers import LaunchpadZopelessLayer
42+from lp.code.enums import BranchLifecycleStatus
43 from lp.codehosting.branchdistro import (
44 DistroBrancher,
45 switch_branches,
46@@ -233,6 +234,12 @@
47 db_branch.sourcepackagename, brancher.new_distroseries.name],
48 [new_branch.owner, new_branch.distribution,
49 new_branch.sourcepackagename, new_branch.name])
50+ # The new branch is set in the development state, and the old one is
51+ # mature.
52+ self.assertEqual(
53+ BranchLifecycleStatus.DEVELOPMENT, new_branch.lifecycle_status)
54+ self.assertEqual(
55+ BranchLifecycleStatus.MATURE, db_branch.lifecycle_status)
56
57 def test_makeOneNewBranch_inconsistent_branch(self):
58 # makeOneNewBranch skips over an inconsistent official package branch