~dpb/tarmac/ls-fixes

« back to all changes in this revision

Viewing changes to tarmac/bin/commands.py

  • Committer: Sidnei da Silva
  • Date: 2012-09-05 14:46:22 UTC
  • Revision ID: sidnei.da.silva@canonical.com-20120905144622-szgx7gcu80bnfy6i
- Don't get the branch as often

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
            return
162
162
 
163
163
        target = Branch.create(lp_branch, self.config, create_tree=True)
164
 
        # Lock the branch for writing
165
 
        target.get_bzr_branch().lock_write()
166
164
 
167
165
        self.logger.debug('Firing tarmac_pre_merge hook')
168
166
        tarmac_hooks.fire('tarmac_pre_merge',
170
168
 
171
169
        try:
172
170
            for proposal in proposals:
 
171
                # Lock the branch for writing
 
172
                target_bzr_branch = target.get_bzr_branch()
 
173
                target_bzr_branch.lock_write()
173
174
                target.cleanup()
174
175
                self.logger.debug(
175
176
                    u'Preparing to merge %(source_branch)s' % {
229
230
                            'source': proposal.source_branch.web_link,
230
231
                            'revision': proposal.reviewed_revid})
231
232
 
232
 
                    target_bzr_branch = target.get_bzr_branch()
233
233
                    target_bzr_branch.unlock()
234
234
                    target.merge(source, str(proposal.reviewed_revid))
235
235
                    target_bzr_branch.lock_write()
282
282
                if commit_message is None and self.config.imply_commit_message:
283
283
                    commit_message = proposal.description
284
284
 
285
 
                target_bzr_branch = target.get_bzr_branch()
286
285
                target_bzr_branch.unlock()
287
286
                target.commit(commit_message,
288
287
                             revprops=revprops,
309
308
        finally:
310
309
            target.cleanup()
311
310
            # We're done, so unlock the branch
312
 
            target_bzr_branch = target.get_bzr_branch()
313
311
            if target_bzr_branch.is_locked():
314
312
                target_bzr_branch.unlock()
315
313