launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #16220
[Merge] lp:~wgrant/launchpad/antibfjo-3-branch-deletion into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/antibfjo-3-branch-deletion into lp:launchpad with lp:~wgrant/launchpad/antibfjo-2.5-no-garbo as a prerequisite.
Commit message:
Teach branch deletion to delete TTBs without a TTBJ.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/antibfjo-3-branch-deletion/+merge/195890
IBuildFarmJobOld and its implementations (BuildPackageJob, SourcePackageRecipeBuildJob, TranslationTemplatesBuildJob) are finally being replaced with an FK from BuildQueue to BuildFarmJob. Additionally, the two fields of Job that are used by BuildQueue are being inlined, and the FK to Job dropped, for performance reasons.
This branch extends branch deletion to delete TranslationTemplatesBuilds even if they're not referenced by a TranslationTemplatesBuildJob.
--
https://code.launchpad.net/~wgrant/launchpad/antibfjo-3-branch-deletion/+merge/195890
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/antibfjo-3-branch-deletion into lp:launchpad.
=== modified file 'lib/lp/buildmaster/model/buildqueue.py'
--- lib/lp/buildmaster/model/buildqueue.py 2013-11-20 00:22:30 +0000
+++ lib/lp/buildmaster/model/buildqueue.py 2013-11-20 00:22:31 +0000
@@ -115,7 +115,7 @@
status = EnumCol(enum=BuildQueueStatus, default=BuildQueueStatus.WAITING)
_date_started = DateTime(tzinfo=pytz.UTC, name='date_started')
- job = ForeignKey(dbName='job', foreignKey='Job', notNull=True)
+ job = ForeignKey(dbName='job', foreignKey='Job')
job_type = EnumCol(
enum=BuildFarmJobType, notNull=True,
default=BuildFarmJobType.PACKAGEBUILD, dbName='job_type')
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2013-06-20 05:50:00 +0000
+++ lib/lp/code/model/branch.py 2013-11-20 00:22:31 +0000
@@ -1268,10 +1268,6 @@
[BranchJob.jobID],
And(BranchJob.job == Job.id, BranchJob.branch == self))
- # Delete BuildQueue entries for affected Jobs. They would pin
- # the affected Jobs in the database otherwise.
- store.find(BuildQueue, BuildQueue.jobID.is_in(affected_jobs)).remove()
-
# Find BuildFarmJobs to delete.
bfjs = store.find(
(BuildFarmJob.id,),
@@ -1279,6 +1275,14 @@
TranslationTemplatesBuild.branch == self)
bfj_ids = [bfj[0] for bfj in bfjs]
+ # Delete BuildQueue entries for affected Jobs. They would pin
+ # the affected Jobs in the database otherwise.
+ store.find(
+ BuildQueue,
+ Or(
+ BuildQueue.jobID.is_in(affected_jobs),
+ BuildQueue._build_farm_job_id.is_in(bfj_ids))).remove()
+
# Delete Jobs. Their BranchJobs cascade along in the database.
store.find(Job, Job.id.is_in(affected_jobs)).remove()
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2013-11-15 00:04:39 +0000
+++ lib/lp/code/model/tests/test_branch.py 2013-11-20 00:22:31 +0000
@@ -1354,6 +1354,13 @@
build.queueBuild()
build.branch.destroySelf(break_references=True)
+ def test_related_TranslationTemplatesBuild_cleaned_out(self):
+ # A TranslationTemplatesBuild for the branch is deleted even if
+ # the corresponding BranchJob doesn't reference the branch. This
+ # is critical as TTBs will soon not have BranchJobs.
+ build = self.factory.makeTranslationTemplatesBuild()
+ build.branch.destroySelf(break_references=True)
+
def test_linked_translations_branch_cleared(self):
# The translations_branch of a series that is linked to the branch
# should be cleared.
Follow ups