~james-w/tarmac/utf8

« back to all changes in this revision

Viewing changes to tarmac/bin/commands.py

  • Committer: Sidnei da Silva
  • Date: 2012-09-05 15:27:59 UTC
  • Revision ID: sidnei.da.silva@canonical.com-20120905152759-j4x5o7roj3irsnnj
- Die locks die

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
 
169
169
        try:
170
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()
174
171
                target.cleanup()
175
172
                self.logger.debug(
176
173
                    u'Preparing to merge %(source_branch)s' % {
230
227
                            'source': proposal.source_branch.web_link,
231
228
                            'revision': proposal.reviewed_revid})
232
229
 
233
 
                    target_bzr_branch.unlock()
234
230
                    target.merge(source, str(proposal.reviewed_revid))
235
 
                    target_bzr_branch.lock_write()
236
231
 
237
232
                    self.logger.debug('Firing tarmac_pre_commit hook')
238
233
                    tarmac_hooks.fire('tarmac_pre_commit',
282
277
                if commit_message is None and self.config.imply_commit_message:
283
278
                    commit_message = proposal.description
284
279
 
285
 
                target_bzr_branch.unlock()
286
280
                target.commit(commit_message,
287
281
                             revprops=revprops,
288
282
                             authors=source.authors,
289
283
                             reviews=self._get_reviews(proposal))
290
 
                target_bzr_branch.lock_write()
291
284
 
292
285
                self.logger.debug('Firing tarmac_post_commit hook')
293
286
                tarmac_hooks.fire('tarmac_post_commit',
307
300
                              self, target)
308
301
        finally:
309
302
            target.cleanup()
310
 
            # We're done, so unlock the branch
311
 
            if target_bzr_branch.is_locked():
312
 
                target_bzr_branch.unlock()
313
303
 
314
304
    def _get_mergable_proposals_for_branch(self, lp_branch):
315
305
        """Return a list of the mergable proposals for the given branch."""