/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: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from .lazy_import import lazy_import
20
20
lazy_import(globals(), """
 
21
import patiencediff
 
22
 
21
23
from breezy import (
22
24
    branch as _mod_branch,
23
25
    cleanup,
26
28
    graph as _mod_graph,
27
29
    merge3,
28
30
    osutils,
29
 
    patiencediff,
30
31
    revision as _mod_revision,
31
32
    textfile,
32
33
    trace,
904
905
        else:
905
906
            interesting_files = None
906
907
        result = []
907
 
        walker = _mod_tree.MultiWalker(self.other_tree, self._lca_trees)
 
908
        from .multiwalker import MultiWalker
 
909
        walker = MultiWalker(self.other_tree, self._lca_trees)
908
910
 
909
 
        base_inventory = self.base_tree.root_inventory
910
 
        this_inventory = self.this_tree.root_inventory
911
 
        for path, file_id, other_ie, lca_values in walker.iter_all():
 
911
        for other_path, file_id, other_ie, lca_values in walker.iter_all():
912
912
            # Is this modified at all from any of the other trees?
913
913
            if other_ie is None:
914
914
                other_ie = _none_entry
915
915
                other_path = None
916
 
            else:
917
 
                other_path = self.other_tree.id2path(file_id)
918
916
            if interesting_files is not None and other_path not in interesting_files:
919
917
                continue
920
918
 
948
946
                    lca_paths.append(lca_path)
949
947
 
950
948
            try:
951
 
                base_ie = base_inventory.get_entry(file_id)
 
949
                base_path = self.base_tree.id2path(file_id)
952
950
            except errors.NoSuchId:
 
951
                base_path = None
953
952
                base_ie = _none_entry
954
 
                base_path = None
955
953
            else:
956
 
                base_path = self.base_tree.id2path(file_id)
 
954
                base_ie = next(self.base_tree.iter_entries_by_dir(specific_files=[base_path]))[1]
957
955
 
958
956
            try:
959
 
                this_ie = this_inventory.get_entry(file_id)
 
957
                this_path = self.this_tree.id2path(file_id)
960
958
            except errors.NoSuchId:
961
959
                this_ie = _none_entry
962
960
                this_path = None
963
961
            else:
964
 
                this_path = self.this_tree.id2path(file_id)
 
962
                this_ie = next(self.this_tree.iter_entries_by_dir(specific_files=[this_path]))[1]
965
963
 
966
964
            lca_kinds = []
967
965
            lca_parent_ids = []
1865
1863
 
1866
1864
    def _entries_to_incorporate(self):
1867
1865
        """Yields pairs of (inventory_entry, new_parent)."""
1868
 
        other_inv = self.other_tree.root_inventory
1869
 
        subdir_id = other_inv.path2id(self._source_subpath)
 
1866
        subdir_id = self.other_tree.path2id(self._source_subpath)
1870
1867
        if subdir_id is None:
1871
1868
            # XXX: The error would be clearer if it gave the URL of the source
1872
1869
            # branch, but we don't have a reference to that here.
1873
1870
            raise PathNotInTree(self._source_subpath, "Source tree")
1874
 
        subdir = other_inv.get_entry(subdir_id)
 
1871
        subdir = next(self.other_tree.iter_entries_by_dir(
 
1872
            specific_files=[self._source_subpath]))[1]
1875
1873
        parent_in_target = osutils.dirname(self._target_subdir)
1876
1874
        target_id = self.this_tree.path2id(parent_in_target)
1877
1875
        if target_id is None:
1893
1891
        if subdir.kind != 'directory':
1894
1892
            # No children, so we are done.
1895
1893
            return
1896
 
        for path, entry in other_inv.iter_entries_by_dir(subdir_id):
 
1894
        for path, entry in self.other_tree.root_inventory.iter_entries_by_dir(subdir_id):
1897
1895
            parent_id = entry.parent_id
1898
1896
            if parent_id == subdir.file_id:
1899
1897
                # The root's parent ID has changed, so make sure children of