← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Tim Penhey has proposed merging lp:~thumper/launchpad/branch-distro-set-old-mature into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #575079 branch-distro should set the status of the old branches to "Mature"
  https://bugs.launchpad.net/bugs/575079


Update the branch-distro script to set the old branches to Mature when creating the new ones.
-- 
https://code.launchpad.net/~thumper/launchpad/branch-distro-set-old-mature/+merge/36095
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/branch-distro-set-old-mature into lp:launchpad/devel.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2010-09-16 12:27:46 +0000
+++ database/schema/security.cfg	2010-09-21 02:51:07 +0000
@@ -628,7 +628,7 @@
 
 [branch-distro]
 type=user
-public.branch                    = SELECT, INSERT
+public.branch                    = SELECT, INSERT, UPDATE
 public.branchsubscription        = SELECT, INSERT
 public.distribution              = SELECT
 public.distroseries              = SELECT

=== modified file 'lib/lp/codehosting/branchdistro.py'
--- lib/lp/codehosting/branchdistro.py	2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/branchdistro.py	2010-09-21 02:51:07 +0000
@@ -28,7 +28,7 @@
 
 from canonical.config import config
 from canonical.launchpad.interfaces import ILaunchpadCelebrities
-from lp.code.enums import BranchType
+from lp.code.enums import BranchLifecycleStatus, BranchType
 from lp.code.errors import BranchExists
 from lp.code.interfaces.branchcollection import IAllBranches
 from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
@@ -341,6 +341,8 @@
         new_db_branch.sourcepackage.setBranch(
             PackagePublishingPocket.RELEASE, new_db_branch,
             getUtility(ILaunchpadCelebrities).ubuntu_branches.teamowner)
+
+        old_db_branch.lifecycle_status = BranchLifecycleStatus.MATURE
         # switch_branches *moves* the data to locations dependent on the
         # new_branch's id, so if the transaction was rolled back we wouldn't
         # know the branch id and thus wouldn't be able to find the branch data

=== modified file 'lib/lp/codehosting/tests/test_branchdistro.py'
--- lib/lp/codehosting/tests/test_branchdistro.py	2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/tests/test_branchdistro.py	2010-09-21 02:51:07 +0000
@@ -34,6 +34,7 @@
     QuietFakeLogger,
     )
 from canonical.testing.layers import LaunchpadZopelessLayer
+from lp.code.enums import BranchLifecycleStatus
 from lp.codehosting.branchdistro import (
     DistroBrancher,
     switch_branches,
@@ -233,6 +234,12 @@
              db_branch.sourcepackagename, brancher.new_distroseries.name],
             [new_branch.owner, new_branch.distribution,
              new_branch.sourcepackagename, new_branch.name])
+        # The new branch is set in the development state, and the old one is
+        # mature.
+        self.assertEqual(
+            BranchLifecycleStatus.DEVELOPMENT, new_branch.lifecycle_status)
+        self.assertEqual(
+            BranchLifecycleStatus.MATURE, db_branch.lifecycle_status)
 
     def test_makeOneNewBranch_inconsistent_branch(self):
         # makeOneNewBranch skips over an inconsistent official package branch