Merge lp:~cjwatson/launchpad/recipe-timeouts into lp:launchpad

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merged at revision: 17361
Proposed branch: lp:~cjwatson/launchpad/recipe-timeouts
Merge into: lp:launchpad
Diff against target: 65 lines (+18/-7)
3 files modified
lib/lp/code/interfaces/branch.py (+3/-0)
lib/lp/code/model/branch.py (+14/-5)
lib/lp/codehosting/scanner/bzrsync.py (+1/-2)
To merge this branch: bzr merge lp:~cjwatson/launchpad/recipe-timeouts
Reviewer Review Type Date Requested Status
William Grant (community) code Approve
Review via email: mp+250913@code.launchpad.net

Commit message

Expose Branch.markRecipesStale so that the branch scanner can avoid the decoration on Branch.recipes.

Description of the change

Expose Branch.markRecipesStale so that the branch scanner can avoid the decoration on Branch.recipes. Fixes lots of buildbot failures.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/interfaces/branch.py'
2--- lib/lp/code/interfaces/branch.py 2014-04-10 11:56:54 +0000
3+++ lib/lp/code/interfaces/branch.py 2015-02-25 12:49:54 +0000
4@@ -652,6 +652,9 @@
5 def scheduleDiffUpdates():
6 """Create UpdatePreviewDiffJobs for this branch's targets."""
7
8+ def markRecipesStale():
9+ """Mark all recipes associated with this branch as stale."""
10+
11 def getStackedBranches():
12 """The branches that are stacked on this one."""
13
14
15=== modified file 'lib/lp/code/model/branch.py'
16--- lib/lp/code/model/branch.py 2015-02-24 13:46:46 +0000
17+++ lib/lp/code/model/branch.py 2015-02-25 12:49:54 +0000
18@@ -619,6 +619,11 @@
19 merge_proposal, old.revision_id, new.revision_id)
20 return jobs
21
22+ def markRecipesStale(self):
23+ """See `IBranch`."""
24+ for recipe in self._recipes:
25+ recipe.is_stale = True
26+
27 def addToLaunchBag(self, launchbag):
28 """See `IBranch`."""
29 launchbag.add(self.product)
30@@ -1404,15 +1409,19 @@
31 return can_access
32
33 @property
34+ def _recipes(self):
35+ """Undecorated version of recipes for use by `markRecipesStale`."""
36+ from lp.code.model.sourcepackagerecipedata import (
37+ SourcePackageRecipeData,
38+ )
39+ return SourcePackageRecipeData.findRecipes(self)
40+
41+ @property
42 def recipes(self):
43 """See `IHasRecipes`."""
44 from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
45- from lp.code.model.sourcepackagerecipedata import (
46- SourcePackageRecipeData,
47- )
48 hook = SourcePackageRecipe.preLoadDataForSourcePackageRecipes
49- return DecoratedResultSet(
50- SourcePackageRecipeData.findRecipes(self), pre_iter_hook=hook)
51+ return DecoratedResultSet(self._recipes, pre_iter_hook=hook)
52
53 merge_queue_id = Int(name='merge_queue', allow_none=True)
54 merge_queue = Reference(merge_queue_id, 'BranchMergeQueue.id')
55
56=== modified file 'lib/lp/codehosting/scanner/bzrsync.py'
57--- lib/lp/codehosting/scanner/bzrsync.py 2013-11-14 08:28:31 +0000
58+++ lib/lp/codehosting/scanner/bzrsync.py 2015-02-25 12:49:54 +0000
59@@ -322,5 +322,4 @@
60
61
62 def update_recipes(tip_changed):
63- for recipe in tip_changed.db_branch.recipes:
64- recipe.is_stale = True
65+ tip_changed.db_branch.markRecipesStale()