/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/merge_directive.py

  • Committer: Jelmer Vernooij
  • Date: 2019-05-20 03:57:29 UTC
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190520035729-9rxvefxkvbbivygy
use default_user_agent function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
lazy_import.lazy_import(globals(), """
24
24
from breezy import (
25
25
    branch as _mod_branch,
26
 
    cleanup,
27
26
    diff,
28
27
    email_message,
 
28
    errors,
29
29
    gpg,
30
30
    hooks,
31
31
    registry,
37
37
from breezy.bzr import (
38
38
    testament,
39
39
    )
40
 
from breezy.bzr.bundle import (
 
40
from breezy.bundle import (
41
41
    serializer as bundle_serializer,
42
42
    )
43
43
""")
44
 
from . import (
45
 
    errors,
46
 
    )
47
44
from .sixish import (
48
45
    BytesIO,
49
46
    )
599
596
        If the message is not supplied, the message from revision_id will be
600
597
        used for the commit.
601
598
        """
602
 
        with cleanup.ExitStack() as exit_stack:
603
 
            exit_stack.enter_context(repository.lock_write())
 
599
        locked = []
 
600
        try:
 
601
            repository.lock_write()
 
602
            locked.append(repository)
604
603
            t_revision_id = revision_id
605
604
            if revision_id == b'null:':
606
605
                t_revision_id = None
610
609
                submit_branch = _mod_branch.Branch.open(target_branch)
611
610
            else:
612
611
                submit_branch = local_target_branch
613
 
            exit_stack.enter_context(submit_branch.lock_read())
 
612
            submit_branch.lock_read()
 
613
            locked.append(submit_branch)
614
614
            if submit_branch.get_public_branch() is not None:
615
615
                target_branch = submit_branch.get_public_branch()
616
616
            submit_revision_id = submit_branch.last_revision()
636
636
 
637
637
            if public_branch is not None and not include_bundle:
638
638
                public_branch_obj = _mod_branch.Branch.open(public_branch)
639
 
                exit_stack.enter_context(public_branch_obj.lock_read())
 
639
                public_branch_obj.lock_read()
 
640
                locked.append(public_branch_obj)
640
641
                if not public_branch_obj.repository.has_revision(
641
642
                        revision_id):
642
643
                    raise errors.PublicBranchOutOfDate(public_branch,
643
644
                                                       revision_id)
644
645
            testament_sha1 = t.as_sha1()
 
646
        finally:
 
647
            for entry in reversed(locked):
 
648
                entry.unlock()
645
649
        return klass(revision_id, testament_sha1, time, timezone,
646
650
                     target_branch, patch, public_branch, message, bundle,
647
651
                     base_revision_id)