launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15346
[Merge] lp:~stevenk/launchpad/productseries-preload-for-merges into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/productseries-preload-for-merges into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/productseries-preload-for-merges/+merge/153052
Rewrite the propertycache loops for BMP preloading -- I'm not certain why setting them to [] was guarded, and then each would end up treating the cache's properties like lists anyway.
I've cleaned up branchcollection more to claw this branch back to net-negative.
--
https://code.launchpad.net/~stevenk/launchpad/productseries-preload-for-merges/+merge/153052
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/productseries-preload-for-merges into lp:launchpad.
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposallisting.py'
--- lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2013-03-04 04:17:17 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2013-03-13 04:55:29 +0000
@@ -209,6 +209,15 @@
product, '+merges', rootsite='code', user=product.owner)
self.assertThat(recorder, HasQueryCount(Equals(40)))
+ def test_productseries(self):
+ target = self.factory.makeBranch()
+ unique_name = target.unique_name
+ with person_logged_in(target.product.owner):
+ target.product.development_focus.branch = target
+ self.factory.makeBranchMergeProposal(target_branch=target)
+ view = self.getViewBrowser(target, '+merges', rootsite='code')
+ self.assertIn(unique_name, view.contents)
+
class ActiveReviewGroupsTest(TestCaseWithFactory):
"""Tests for groupings used in for active reviews."""
=== modified file 'lib/lp/code/model/branchcollection.py'
--- lib/lp/code/model/branchcollection.py 2013-02-14 03:53:10 +0000
+++ lib/lp/code/model/branchcollection.py 2013-03-13 04:55:29 +0000
@@ -255,12 +255,9 @@
for branch in branches)
branch_ids = caches.keys()
for cache in caches.values():
- if not safe_hasattr(cache, '_associatedProductSeries'):
- cache._associatedProductSeries = []
- if not safe_hasattr(cache, '_associatedSuiteSourcePackages'):
- cache._associatedSuiteSourcePackages = []
- if not safe_hasattr(cache, 'code_import'):
- cache.code_import = None
+ cache._associatedProductSeries = []
+ cache._associatedSuiteSourcePackages = []
+ cache.code_import = None
# associatedProductSeries
# Imported here to avoid circular import.
from lp.registry.model.productseries import ProductSeries
@@ -306,8 +303,7 @@
def cache_permission(branch):
if self._user:
- get_property_cache(branch)._known_viewers = (
- set([self._user.id]))
+ get_property_cache(branch)._known_viewers = [self._user.id]
return branch
eager_load_hook = (
@@ -528,8 +524,7 @@
linked_bugtasks[branch.id].extend(
filter_bugtasks_by_context(branch.target.context, tasks))
- return [make_rev_info(
- rev, merge_proposal_revs, linked_bugtasks)
+ return [make_rev_info(rev, merge_proposal_revs, linked_bugtasks)
for rev in revisions]
def getTeamsWithBranches(self, person):
@@ -543,8 +538,7 @@
Person,
Person.id == TeamParticipation.teamID,
TeamParticipation.person == person,
- TeamParticipation.team != person,
- Person.id.is_in(branch_query))
+ TeamParticipation.team != person, Person.id.is_in(branch_query))
def inProduct(self, product):
"""See `IBranchCollection`."""
@@ -555,8 +549,7 @@
"""See `IBranchCollection`."""
return self._filterBy(
[Product.project == project.id],
- table=Product,
- join=Join(Product, Branch.product == Product.id))
+ table=Product, join=Join(Product, Branch.product == Product.id))
def inDistribution(self, distribution):
"""See `IBranchCollection`."""
@@ -599,14 +592,13 @@
def isJunk(self):
"""See `IBranchCollection`."""
- return self._filterBy([
- Branch.product == None,
- Branch.sourcepackagename == None])
+ return self._filterBy(
+ [Branch.product == None, Branch.sourcepackagename == None])
def isPrivate(self):
"""See `IBranchCollection`."""
- return self._filterBy([
- Branch.information_type.is_in(PRIVATE_INFORMATION_TYPES)])
+ return self._filterBy(
+ [Branch.information_type.is_in(PRIVATE_INFORMATION_TYPES)])
def isExclusive(self):
"""See `IBranchCollection`."""
@@ -617,7 +609,7 @@
def isSeries(self):
"""See `IBranchCollection`."""
- # ProductSeries import's this module.
+ # Circular imports.
from lp.registry.model.productseries import ProductSeries
return self._filterBy(
[Branch.id == ProductSeries.branchID],
@@ -633,9 +625,7 @@
subquery = Select(
TeamParticipation.teamID,
where=TeamParticipation.personID == person.id)
- filter = [In(Branch.ownerID, subquery)]
-
- return self._filterBy(filter, symmetric=False)
+ return self._filterBy([In(Branch.ownerID, subquery)], symmetric=False)
def registeredBy(self, person):
"""See `IBranchCollection`."""
@@ -721,18 +711,18 @@
self._asymmetric_filter_expressions, self._asymmetric_tables)
def withBranchType(self, *branch_types):
- return self._filterBy([Branch.branch_type.is_in(branch_types)],
- symmetric=False)
+ return self._filterBy(
+ [Branch.branch_type.is_in(branch_types)], symmetric=False)
def withLifecycleStatus(self, *statuses):
"""See `IBranchCollection`."""
- return self._filterBy([Branch.lifecycle_status.is_in(statuses)],
- symmetric=False)
+ return self._filterBy(
+ [Branch.lifecycle_status.is_in(statuses)], symmetric=False)
def modifiedSince(self, epoch):
"""See `IBranchCollection`."""
- return self._filterBy([Branch.date_last_modified > epoch],
- symmetric=False)
+ return self._filterBy(
+ [Branch.date_last_modified > epoch], symmetric=False)
def scannedSince(self, epoch):
"""See `IBranchCollection`."""