/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-11-16 18:35:30 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7178.
  • Revision ID: jelmer@jelmer.uk-20181116183530-ue8yx60h5tinl2wy
Merge more-cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
637
637
            hook(merge)
638
638
        if self.recurse == 'down':
639
639
            for relpath, file_id in self.this_tree.iter_references():
640
 
                sub_tree = self.this_tree.get_nested_tree(relpath, file_id)
 
640
                sub_tree = self.this_tree.get_nested_tree(relpath)
641
641
                other_revision = self.other_tree.get_reference_revision(
642
 
                    relpath, file_id)
 
642
                    relpath)
643
643
                if other_revision == sub_tree.last_revision():
644
644
                    continue
645
645
                sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
650
650
                base_tree_path = _mod_tree.find_previous_path(
651
651
                    self.this_tree, self.base_tree, relpath)
652
652
                base_revision = self.base_tree.get_reference_revision(
653
 
                    base_tree_path, file_id)
 
653
                    base_tree_path)
654
654
                sub_merge.base_tree = \
655
655
                    sub_tree.branch.repository.revision_tree(base_revision)
656
656
                sub_merge.base_rev_id = base_revision
996
996
                        if path is None:
997
997
                            return None
998
998
                        try:
999
 
                            return tree.get_file_sha1(path, file_id)
 
999
                            return tree.get_file_sha1(path)
1000
1000
                        except errors.NoSuchFile:
1001
1001
                            return None
1002
1002
                    base_sha1 = get_sha1(self.base_tree, base_path)
1022
1022
                    def get_target(ie, tree, path):
1023
1023
                        if ie.kind != 'symlink':
1024
1024
                            return None
1025
 
                        return tree.get_symlink_target(path, file_id)
1026
 
                    base_target = get_target(
1027
 
                        base_ie, self.base_tree, base_path)
 
1025
                        return tree.get_symlink_target(path)
 
1026
                    base_target = get_target(base_ie, self.base_tree, base_path)
1028
1027
                    lca_targets = [get_target(ie, tree, lca_path) for ie, tree, lca_path
1029
1028
                                   in zip(lca_entries, self._lca_trees, lca_paths)]
1030
1029
                    this_target = get_target(
1074
1073
            file_id = self.working_tree.path2id(wt_relpath)
1075
1074
            if file_id is None:
1076
1075
                continue
1077
 
            hash = self.working_tree.get_file_sha1(wt_relpath, file_id)
 
1076
            hash = self.working_tree.get_file_sha1(wt_relpath)
1078
1077
            if hash is None:
1079
1078
                continue
1080
1079
            modified_hashes[file_id] = hash
1110
1109
                return False
1111
1110
        except errors.NoSuchFile:
1112
1111
            return None
1113
 
        return tree.is_executable(path, file_id)
 
1112
        return tree.is_executable(path)
1114
1113
 
1115
1114
    @staticmethod
1116
1115
    def kind(tree, path, file_id=None):
1238
1237
            if path is None:
1239
1238
                return (None, None)
1240
1239
            try:
1241
 
                kind = tree.kind(path, file_id)
 
1240
                kind = tree.kind(path)
1242
1241
            except errors.NoSuchFile:
1243
1242
                return (None, None)
1244
1243
            if kind == "file":
1245
 
                contents = tree.get_file_sha1(path, file_id)
 
1244
                contents = tree.get_file_sha1(path)
1246
1245
            elif kind == "symlink":
1247
 
                contents = tree.get_symlink_target(path, file_id)
 
1246
                contents = tree.get_symlink_target(path)
1248
1247
            else:
1249
1248
                contents = None
1250
1249
            return kind, contents
1406
1405
        if path is None:
1407
1406
            return []
1408
1407
        try:
1409
 
            kind = tree.kind(path, file_id)
 
1408
            kind = tree.kind(path)
1410
1409
        except errors.NoSuchFile:
1411
1410
            return []
1412
1411
        else:
1413
1412
            if kind != 'file':
1414
1413
                return []
1415
 
            return tree.get_file_lines(path, file_id)
 
1414
            return tree.get_file_lines(path)
1416
1415
 
1417
1416
    def text_merge(self, trans_id, paths, file_id):
1418
1417
        """Perform a three-way text merge on a file_id"""
1707
1706
    def dump_file(self, temp_dir, name, tree, path, file_id=None):
1708
1707
        out_path = osutils.pathjoin(temp_dir, name)
1709
1708
        with open(out_path, "wb") as out_file:
1710
 
            in_file = tree.get_file(path, file_id=None)
 
1709
            in_file = tree.get_file(path)
1711
1710
            for line in in_file:
1712
1711
                out_file.write(line)
1713
1712
        return out_path