/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-18 00:25:19 UTC
  • mto: This revision was merged to the branch mainline in revision 7210.
  • Revision ID: jelmer@jelmer.uk-20181118002519-asqb8yjtua9822ob
Remove more file ids.

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
    @decorators.cachedproperty
251
251
    def base_lines(self):
252
252
        """The lines of the 'base' version of the file."""
253
 
        return self._merger.get_lines(self._merger.base_tree, self.base_path, self.file_id)
 
253
        return self._merger.get_lines(self._merger.base_tree, self.base_path)
254
254
 
255
255
    @decorators.cachedproperty
256
256
    def this_lines(self):
257
257
        """The lines of the 'this' version of the file."""
258
 
        return self._merger.get_lines(self._merger.this_tree, self.this_path, self.file_id)
 
258
        return self._merger.get_lines(self._merger.this_tree, self.this_path)
259
259
 
260
260
    @decorators.cachedproperty
261
261
    def other_lines(self):
262
262
        """The lines of the 'other' version of the file."""
263
 
        return self._merger.get_lines(self._merger.other_tree, self.other_path, self.file_id)
 
263
        return self._merger.get_lines(self._merger.other_tree, self.other_path)
264
264
 
265
265
 
266
266
class Merger(object):
1080
1080
        self.working_tree.set_merge_modified(modified_hashes)
1081
1081
 
1082
1082
    @staticmethod
1083
 
    def parent(entry, file_id):
 
1083
    def parent(entry):
1084
1084
        """Determine the parent for a file_id (used as a key method)"""
1085
1085
        if entry is None:
1086
1086
            return None
1087
1087
        return entry.parent_id
1088
1088
 
1089
1089
    @staticmethod
1090
 
    def name(entry, file_id):
 
1090
    def name(entry):
1091
1091
        """Determine the name for a file_id (used as a key method)"""
1092
1092
        if entry is None:
1093
1093
            return None
1094
1094
        return entry.name
1095
1095
 
1096
1096
    @staticmethod
1097
 
    def contents_sha1(tree, path, file_id=None):
 
1097
    def contents_sha1(tree, path):
1098
1098
        """Determine the sha1 of the file contents (used as a key method)."""
1099
1099
        try:
1100
 
            return tree.get_file_sha1(path, file_id)
 
1100
            return tree.get_file_sha1(path)
1101
1101
        except errors.NoSuchFile:
1102
1102
            return None
1103
1103
 
1104
1104
    @staticmethod
1105
 
    def executable(tree, path, file_id=None):
 
1105
    def executable(tree, path):
1106
1106
        """Determine the executability of a file-id (used as a key method)."""
1107
1107
        try:
1108
 
            if tree.kind(path, file_id) != "file":
 
1108
            if tree.kind(path) != "file":
1109
1109
                return False
1110
1110
        except errors.NoSuchFile:
1111
1111
            return None
1112
1112
        return tree.is_executable(path)
1113
1113
 
1114
1114
    @staticmethod
1115
 
    def kind(tree, path, file_id=None):
 
1115
    def kind(tree, path):
1116
1116
        """Determine the kind of a file-id (used as a key method)."""
1117
1117
        try:
1118
 
            return tree.kind(path, file_id)
 
1118
            return tree.kind(path)
1119
1119
        except errors.NoSuchFile:
1120
1120
            return None
1121
1121
 
1400
1400
        else:
1401
1401
            return 'not_applicable', None
1402
1402
 
1403
 
    def get_lines(self, tree, path, file_id=None):
 
1403
    def get_lines(self, tree, path):
1404
1404
        """Return the lines in a file, or an empty list."""
1405
1405
        if path is None:
1406
1406
            return []
1703
1703
 
1704
1704
    requires_file_merge_plan = False
1705
1705
 
1706
 
    def dump_file(self, temp_dir, name, tree, path, file_id=None):
 
1706
    def dump_file(self, temp_dir, name, tree, path):
1707
1707
        out_path = osutils.pathjoin(temp_dir, name)
1708
1708
        with open(out_path, "wb") as out_file:
1709
1709
            in_file = tree.get_file(path)
1722
1722
        try:
1723
1723
            new_file = osutils.pathjoin(temp_dir, "new")
1724
1724
            this = self.dump_file(
1725
 
                temp_dir, "this", self.this_tree, this_path, file_id)
 
1725
                temp_dir, "this", self.this_tree, this_path)
1726
1726
            base = self.dump_file(
1727
 
                temp_dir, "base", self.base_tree, base_path, file_id)
 
1727
                temp_dir, "base", self.base_tree, base_path)
1728
1728
            other = self.dump_file(
1729
 
                temp_dir, "other", self.other_tree, other_path, file_id)
 
1729
                temp_dir, "other", self.other_tree, other_path)
1730
1730
            status = breezy.patch.diff3(new_file, this, base, other)
1731
1731
            if status not in (0, 1):
1732
1732
                raise errors.BzrError("Unhandled diff3 exit code")