def make_branch_with_commits_and_scan_job(self, db_branch):
     """Create a branch from a db_branch, make commits and a scan job."""
     target, target_tree = self.create_branch_and_tree(db_branch=db_branch)
     # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
     # required to generate the revision-id.
     with override_environ(BZR_EMAIL='*****@*****.**'):
         target_tree.commit('First commit', rev_id='rev1')
         target_tree.commit('Second commit', rev_id='rev2')
         target_tree.commit('Third commit', rev_id='rev3')
     BranchScanJob.create(db_branch)
     transaction.commit()
 def make_branch_with_commits_and_scan_job(self, db_branch):
     """Create a branch from a db_branch, make commits and a scan job."""
     target, target_tree = self.create_branch_and_tree(db_branch=db_branch)
     # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
     # required to generate the revision-id.
     with override_environ(BZR_EMAIL='*****@*****.**'):
         target_tree.commit('First commit', rev_id='rev1')
         target_tree.commit('Second commit', rev_id='rev2')
         target_tree.commit('Third commit', rev_id='rev3')
     BranchScanJob.create(db_branch)
     transaction.commit()
Exemple #3
0
    def unscan(self, branch):
        self.logger.info("Unscanning %s (last scanned id: %s)",
                         branch.displayname, branch.last_scanned_id)
        self.logger.debug("Purging BranchRevisions.")
        IStore(BranchRevision).find(BranchRevision, branch=branch).remove()

        self.logger.debug("Resetting scan data.")
        branch.last_scanned = branch.last_scanned_id = None
        branch.revision_count = 0

        if self.options.rescan:
            self.logger.debug("Requesting rescan.")
            job = BranchScanJob.create(branch)
            job.celeryRunOnCommit()

        transaction.commit()
    def unscan(self, branch):
        self.logger.info(
            "Unscanning %s (last scanned id: %s)", branch.displayname,
            branch.last_scanned_id)
        self.logger.debug("Purging BranchRevisions.")
        IStore(BranchRevision).find(BranchRevision, branch=branch).remove()

        self.logger.debug("Resetting scan data.")
        branch.last_scanned = branch.last_scanned_id = None
        branch.revision_count = 0

        if self.options.rescan:
            self.logger.debug("Requesting rescan.")
            job = BranchScanJob.create(branch)
            job.celeryRunOnCommit()

        transaction.commit()
 def createMissingJob(self):
     job = BranchScanJob.create(self.factory.makeBranch())
     self.addCleanup(drain_celery_queues)
     return job
 def createMissingJob(self):
     job = BranchScanJob.create(self.factory.makeBranch())
     self.addCleanup(drain_celery_queues)
     return job