/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: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
648
648
                    continue
649
649
                sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
650
650
                sub_merge.merge_type = self.merge_type
651
 
                other_branch = self.other_branch.reference_parent(
652
 
                    relpath, file_id)
 
651
                other_branch = self.other_branch.reference_parent(file_id,
 
652
                                                                  relpath)
653
653
                sub_merge.set_other_revision(other_revision, other_branch)
654
654
                base_tree_path = _mod_tree.find_previous_path(
655
655
                    self.this_tree, self.base_tree, relpath)
953
953
                    lca_paths.append(None)
954
954
                else:
955
955
                    lca_entries.append(lca_ie)
956
 
                    lca_paths.append(lca_path)
 
956
                    lca_paths.append(path)
957
957
 
958
958
            try:
959
 
                base_ie = base_inventory.get_entry(file_id)
 
959
                base_ie = base_inventory[file_id]
960
960
            except errors.NoSuchId:
961
961
                base_ie = _none_entry
962
962
                base_path = None
964
964
                base_path = self.base_tree.id2path(file_id)
965
965
 
966
966
            try:
967
 
                this_ie = this_inventory.get_entry(file_id)
 
967
                this_ie = this_inventory[file_id]
968
968
            except errors.NoSuchId:
969
969
                this_ie = _none_entry
970
970
                this_path = None
1008
1008
                        except errors.NoSuchFile:
1009
1009
                            return None
1010
1010
                    base_sha1 = get_sha1(self.base_tree, base_path)
1011
 
                    lca_sha1s = [get_sha1(tree, lca_path)
1012
 
                                 for tree, lca_path
 
1011
                    lca_sha1s = [get_sha1(tree, lca_path) for tree, lca_path
1013
1012
                                 in zip(self._lca_trees, lca_paths)]
1014
1013
                    this_sha1 = get_sha1(self.this_tree, this_path)
1015
1014
                    other_sha1 = get_sha1(self.other_tree, other_path)
1191
1190
        # At this point, the lcas disagree, and the tip disagree
1192
1191
        return 'conflict'
1193
1192
 
1194
 
    def merge_names(self, paths):
1195
 
        def get_entry(tree, path):
 
1193
    def merge_names(self, file_id):
 
1194
        def get_entry(tree):
1196
1195
            try:
1197
 
                return next(tree.iter_entries_by_dir(specific_files=[path]))[1]
1198
 
            except StopIteration:
 
1196
                return tree.root_inventory[file_id]
 
1197
            except errors.NoSuchId:
1199
1198
                return None
1200
 
        used_base_path, other_path, this_path = paths
1201
 
        this_entry = get_entry(self.this_tree, this_path)
1202
 
        other_entry = get_entry(self.other_tree, other_path)
1203
 
        base_entry = get_entry(self.base_tree, base_path)
 
1199
        this_entry = get_entry(self.this_tree)
 
1200
        other_entry = get_entry(self.other_tree)
 
1201
        base_entry = get_entry(self.base_tree)
1204
1202
        entries = (base_entry, other_entry, this_entry)
1205
1203
        names = []
1206
1204
        parents = []
1358
1356
                    self.tt.unversion_file(trans_id)
1359
1357
                # This is a contents conflict, because none of the available
1360
1358
                # functions could merge it.
1361
 
                file_group = self._dump_conflicts(
1362
 
                        name, (base_path, other_path, this_path), parent_id,
1363
 
                        file_id, set_version=True)
 
1359
                file_group = self._dump_conflicts(name, paths, parent_id, file_id,
 
1360
                                                  set_version=True)
1364
1361
                self._raw_conflicts.append(('contents conflict', file_group))
1365
1362
        elif hook_status == 'success':
1366
1363
            self.tt.create_file(lines, trans_id)
1371
1368
            self._raw_conflicts.append(('text conflict', trans_id))
1372
1369
            name = self.tt.final_name(trans_id)
1373
1370
            parent_id = self.tt.final_parent(trans_id)
1374
 
            self._dump_conflicts(
1375
 
                name, (base_path, other_path, this_path), parent_id, file_id)
 
1371
            self._dump_conflicts(name, paths, parent_id, file_id)
1376
1372
        elif hook_status == 'delete':
1377
1373
            self.tt.unversion_file(trans_id)
1378
1374
            result = "deleted"
1566
1562
        if winner == "conflict":
1567
1563
        # There must be a None in here, if we have a conflict, but we
1568
1564
        # need executability since file status was not deleted.
1569
 
            if other_path is None:
 
1565
            if self.executable(self.other_tree, other_path, file_id) is None:
1570
1566
                winner = "this"
1571
1567
            else:
1572
1568
                winner = "other"
1896
1892
            # XXX: The error would be clearer if it gave the URL of the source
1897
1893
            # branch, but we don't have a reference to that here.
1898
1894
            raise PathNotInTree(self._source_subpath, "Source tree")
1899
 
        subdir = other_inv.get_entry(subdir_id)
 
1895
        subdir = other_inv[subdir_id]
1900
1896
        parent_in_target = osutils.dirname(self._target_subdir)
1901
1897
        target_id = self.this_tree.path2id(parent_in_target)
1902
1898
        if target_id is None: