launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07686
[Merge] lp:~stevenk/launchpad/drop-branch-information_type-garbo into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/drop-branch-information_type-garbo into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #933768 in Launchpad itself: "Update branch to use information_visibility_policy"
https://bugs.launchpad.net/launchpad/+bug/933768
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/drop-branch-information_type-garbo/+merge/105164
Since the garbo job to populate IBranch.information_type is done, we can remove it.
--
https://code.launchpad.net/~stevenk/launchpad/drop-branch-information_type-garbo/+merge/105164
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/drop-branch-information_type-garbo into lp:launchpad.
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py 2012-05-07 07:31:49 +0000
+++ lib/lp/scripts/garbo.py 2012-05-09 05:59:19 +0000
@@ -51,7 +51,6 @@
MAX_SAMPLE_SIZE,
)
from lp.code.interfaces.revision import IRevisionSet
-from lp.code.model.branch import Branch
from lp.code.model.codeimportevent import CodeImportEvent
from lp.code.model.codeimportresult import CodeImportResult
from lp.code.model.revision import (
@@ -59,7 +58,6 @@
RevisionCache,
)
from lp.hardwaredb.model.hwdb import HWSubmission
-from lp.registry.enums import InformationType
from lp.registry.model.person import Person
from lp.services.config import config
from lp.services.database import postgresql
@@ -837,32 +835,6 @@
transaction.commit()
-class BranchInformationTypeMigrator(TunableLoop):
- """A `TunableLoop` to populate information_type for all branches."""
-
- maximum_chunk_size = 5000
-
- def __init__(self, log, abort_time=None):
- super(BranchInformationTypeMigrator, self).__init__(log, abort_time)
- self.transaction = transaction
- self.store = IMasterStore(Branch)
-
- def findBranches(self):
- return self.store.find(Branch.id, Branch.information_type == None)
-
- def isDone(self):
- return self.findBranches().is_empty()
-
- def __call__(self, chunk_size):
- self.store.find(
- Branch, Branch.id.is_in(self.findBranches()[:chunk_size])).set(
- information_type=SQL(
- "CASE WHEN transitively_private THEN ? ELSE ? END",
- params=(InformationType.USERDATA.value,
- InformationType.PUBLIC.value)))
- self.transaction.commit()
-
-
class BugWatchActivityPruner(BulkPruner):
"""A TunableLoop to prune BugWatchActivity entries."""
target_table_class = BugWatchActivity
@@ -1417,7 +1389,6 @@
DuplicateSessionPruner,
BugHeatUpdater,
BugTaskFlattener,
- BranchInformationTypeMigrator,
]
experimental_tunable_loops = []
=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py 2012-05-07 07:31:49 +0000
+++ lib/lp/scripts/tests/test_garbo.py 2012-05-09 05:59:19 +0000
@@ -55,7 +55,6 @@
)
from lp.code.model.codeimportevent import CodeImportEvent
from lp.code.model.codeimportresult import CodeImportResult
-from lp.registry.enums import InformationType
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.person import IPersonSet
from lp.scripts.garbo import (
@@ -1150,28 +1149,6 @@
self.runHourly()
self.assertEqual((task.id,), get_flat())
- def test_BranchInformationTypeMigrator_public(self):
- # A non-migrated public branch will have information_type set
- # correctly.
- switch_dbuser('testadmin')
- branch = self.factory.makeBranch()
- # Since creating a branch will set information_type, unset it.
- removeSecurityProxy(branch).information_type = None
- transaction.commit()
- self.runHourly()
- self.assertEqual(InformationType.PUBLIC, branch.information_type)
-
- def test_BranchInformationTypeMigrator_private(self):
- # A non-migrated private branch will have information_type set
- # correctly.
- switch_dbuser('testadmin')
- branch = self.factory.makeBranch(private=True)
- # Since creating a branch will set information_type, unset it.
- removeSecurityProxy(branch).information_type = None
- transaction.commit()
- self.runHourly()
- self.assertEqual(InformationType.USERDATA, branch.information_type)
-
class TestGarboTasks(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
Follow ups