def run(self): """See `IRosettaUploadJob`.""" with server(get_ro_server(), no_replace=True): # This is not called upon job creation because the branch would # neither have been mirrored nor scanned then. self._init_translation_file_lists() # Get the product series that are connected to this branch and # that want to upload translations. productseriesset = getUtility(IProductSeriesSet) productseries = productseriesset.findByTranslationsImportBranch( self.branch, self.force_translations_upload) translation_import_queue = getUtility(ITranslationImportQueue) for series in productseries: approver = TranslationBranchApprover(self.file_names, productseries=series) for iter_info in self._iter_lists_and_uploaders(series): file_names, changed_files, uploader = iter_info for upload_file_name, upload_file_content in changed_files: if len(upload_file_content) == 0: continue # Skip empty files entry = translation_import_queue.addOrUpdateEntry( upload_file_name, upload_file_content, True, uploader, productseries=series) approver.approve(entry)
def run(self): revision_set = getUtility(IRevisionSet) old_revision = revision_set.getByRevisionId(self.old_revision_id) new_revision = revision_set.getByRevisionId(self.new_revision_id) with server(get_ro_server(), no_replace=True): self.branch_merge_proposal.generateIncrementalDiff( old_revision, new_revision)
def run(self): """See `IBranchScanJob`.""" from lp.services.scripts import log with server(get_ro_server(), no_replace=True): try: with try_advisory_lock(LockType.BRANCH_SCAN, self.branch.id, Store.of(self.branch)): bzrsync = BzrSync(self.branch, log) bzrsync.syncBranchAndClose() except LostObjectError: log.warning('Skipping branch %s because it has been deleted.' % self._cached_branch_name)
def run(self): """See `IBranchScanJob`.""" from lp.services.scripts import log with server(get_ro_server(), no_replace=True): try: with try_advisory_lock( LockType.BRANCH_SCAN, self.branch.id, Store.of(self.branch)): bzrsync = BzrSync(self.branch, log) bzrsync.syncBranchAndClose() except LostObjectError: log.warning('Skipping branch %s because it has been deleted.' % self._cached_branch_name)
def run(self): """Send all the emails about all the added revisions.""" diff_levels = (BranchSubscriptionNotificationLevel.DIFFSONLY, BranchSubscriptionNotificationLevel.FULL) subscriptions = self.branch.getSubscriptionsByLevel(diff_levels) if not subscriptions: return with server(get_ro_server(), no_replace=True): with read_locked(self.bzr_branch): for revision, revno in self.iterAddedMainline(): assert revno is not None mailer = self.getMailerForRevision( revision, revno, self.generateDiffs()) mailer.sendAll()
def run(self): """See `IRunnableJob`.""" self.checkReady() if self.branch_merge_proposal.source_branch is not None: server_context = server(get_ro_server(), no_replace=True) else: # A no-op context manager. (This could be simplified with # contextlib.ExitStack from Python 3.3.) server_context = contextmanager(lambda: (None for _ in [None]))() # Update related bug links based on commits in the source branch. self.branch_merge_proposal.updateRelatedBugsFromSource() with server_context: with BranchMergeProposalDelta.monitor(self.branch_merge_proposal): PreviewDiff.fromBranchMergeProposal(self.branch_merge_proposal)
def main(self): if self.options.dry_run: server = get_ro_server() else: server = get_rw_server() server.start_server() if self.options.dry_run: self.logger.debug('Running read-only') self.logger.debug('Beginning processing') try: self.updateBranches(self.parseFromStream(sys.stdin)) finally: server.stop_server() self.logger.info('Done')
def run(self): revision_set = getUtility(IRevisionSet) old_revision = revision_set.getByRevisionId(self.old_revision_id) new_revision = revision_set.getByRevisionId(self.new_revision_id) with server(get_ro_server(), no_replace=True): self.branch_merge_proposal.generateIncrementalDiff(old_revision, new_revision)
def run(self): """See `IRunnableJob`.""" self.checkReady() with server(get_ro_server(), no_replace=True): with BranchMergeProposalDelta.monitor(self.branch_merge_proposal): PreviewDiff.fromBranchMergeProposal(self.branch_merge_proposal)