436
436
message = message_callback(self)
437
437
self.message = message
439
if self.builder.updates_branch:
440
# Remember the current last revision, in case
441
# the pre_commit hook raises an exception
442
# and the branch has to be reverted.
443
old_rev_info = self.branch.last_revision_info()
444
if self.bound_branch:
445
raise AssertionError(
446
"bound branches not supported for commit builders "
447
"that update the branch")
439
449
# Add revision data to the local branch
440
450
self.rev_id = self.builder.commit(self.message)
445
455
self.builder.abort()
448
self._process_pre_hooks(old_revno, new_revno)
450
# Upload revision data to the master.
451
# this will propagate merged revisions too if needed.
452
if self.bound_branch:
453
self._set_progress_stage("Uploading data to master branch")
454
# 'commit' to the master first so a timeout here causes the
455
# local branch to be out of date
456
(new_revno, self.rev_id) = self.master_branch.import_last_revision_info_and_tags(
457
self.branch, new_revno, self.rev_id, lossy=lossy)
459
self.branch.fetch(self.master_branch, self.rev_id)
461
# and now do the commit locally.
462
self.branch.set_last_revision_info(new_revno, self.rev_id)
458
if not self.builder.updates_branch:
459
self._process_pre_hooks(old_revno, new_revno)
461
# Upload revision data to the master.
462
# this will propagate merged revisions too if needed.
463
if self.bound_branch:
464
self._set_progress_stage("Uploading data to master branch")
465
# 'commit' to the master first so a timeout here causes the
466
# local branch to be out of date
467
(new_revno, self.rev_id) = self.master_branch.import_last_revision_info_and_tags(
468
self.branch, new_revno, self.rev_id, lossy=lossy)
470
self.branch.fetch(self.master_branch, self.rev_id)
472
# and now do the commit locally.
473
self.branch.set_last_revision_info(new_revno, self.rev_id)
476
self._process_pre_hooks(old_revno, new_revno)
478
# The commit builder will already have updated the branch,
480
self.branch.set_last_revision_info(
481
old_rev_info[0], old_rev_info[1])
464
484
# Merge local tags to remote
465
485
if self.bound_branch: