/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.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from __future__ import absolute_import
18
18
 
 
19
import contextlib
 
20
 
19
21
from .lazy_import import lazy_import
20
22
lazy_import(globals(), """
21
23
import patiencediff
22
24
 
23
25
from breezy import (
24
26
    branch as _mod_branch,
25
 
    cleanup,
26
27
    conflicts as _mod_conflicts,
27
28
    debug,
28
29
    graph as _mod_graph,
49
50
    hooks,
50
51
    registry,
51
52
    )
52
 
from .sixish import (
53
 
    viewitems,
54
 
    )
55
53
# TODO: Report back as changes are merged in
56
54
 
57
55
 
447
445
    def _add_parent(self):
448
446
        new_parents = self.this_tree.get_parent_ids() + [self.other_rev_id]
449
447
        new_parent_trees = []
450
 
        with cleanup.ExitStack() as stack:
 
448
        with contextlib.ExitStack() as stack:
451
449
            for revision_id in new_parents:
452
450
                try:
453
451
                    tree = self.revision_tree(revision_id)
654
652
        return merge
655
653
 
656
654
    def do_merge(self):
657
 
        with cleanup.ExitStack() as stack:
 
655
        with contextlib.ExitStack() as stack:
658
656
            stack.enter_context(self.this_tree.lock_tree_write())
659
657
            if self.base_tree is not None:
660
658
                stack.enter_context(self.base_tree.lock_read())
757
755
            self.do_merge()
758
756
 
759
757
    def do_merge(self):
760
 
        with cleanup.ExitStack() as stack:
 
758
        with contextlib.ExitStack() as stack:
761
759
            stack.enter_context(self.working_tree.lock_tree_write())
762
760
            stack.enter_context(self.this_tree.lock_read())
763
761
            stack.enter_context(self.base_tree.lock_read())
2255
2253
        filtered_parent_map = {}
2256
2254
        child_map = {}
2257
2255
        tails = []
2258
 
        for key, parent_keys in viewitems(parent_map):
 
2256
        for key, parent_keys in parent_map.items():
2259
2257
            culled_parent_keys = [p for p in parent_keys if p in parent_map]
2260
2258
            if not culled_parent_keys:
2261
2259
                tails.append(key)