~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Ian Clatworthy
  • Date: 2009-06-16 12:06:49 UTC
  • mto: (4634.102.1 eol-update-bug)
  • mto: This revision was merged to the branch mainline in revision 4857.
  • Revision ID: ian.clatworthy@canonical.com-20090616120649-weg1a7hmbmsdpvse
apply content filters when merging new files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1147
1147
                self.tt.delete_contents(trans_id)
1148
1148
            if file_id in self.other_tree:
1149
1149
                # OTHER changed the file
 
1150
                wt = self.this_tree
 
1151
                if wt.supports_content_filtering():
 
1152
                    filter_tree_path = self.other_tree.id2path(file_id)
 
1153
                else:
 
1154
                    # Skip the id2path lookup for older formats
 
1155
                    filter_tree_path = None
1150
1156
                create_from_tree(self.tt, trans_id,
1151
 
                                 self.other_tree, file_id)
 
1157
                                 self.other_tree, file_id,
 
1158
                                 filter_tree_path=filter_tree_path)
1152
1159
                if not file_in_this:
1153
1160
                    self.tt.version_file(file_id, trans_id)
1154
1161
                return "modified"
1241
1248
                ('THIS', self.this_tree, this_lines)]
1242
1249
        if not no_base:
1243
1250
            data.append(('BASE', self.base_tree, base_lines))
 
1251
 
 
1252
        # We need to use the actual path in the working tree of the file here,
 
1253
        # ignoring the conflict suffixes
 
1254
        wt = self.this_tree
 
1255
        if wt.supports_content_filtering():
 
1256
            try:
 
1257
                filter_tree_path = wt.id2path(file_id)
 
1258
            except errors.NoSuchId:
 
1259
                # file has been deleted
 
1260
                filter_tree_path = None
 
1261
        else:
 
1262
            # Skip the id2path lookup for older formats
 
1263
            filter_tree_path = None
 
1264
 
1244
1265
        versioned = False
1245
1266
        file_group = []
1246
1267
        for suffix, tree, lines in data:
1247
1268
            if file_id in tree:
1248
1269
                trans_id = self._conflict_file(name, parent_id, tree, file_id,
1249
 
                                               suffix, lines)
 
1270
                                               suffix, lines, filter_tree_path)
1250
1271
                file_group.append(trans_id)
1251
1272
                if set_version and not versioned:
1252
1273
                    self.tt.version_file(file_id, trans_id)
1254
1275
        return file_group
1255
1276
 
1256
1277
    def _conflict_file(self, name, parent_id, tree, file_id, suffix,
1257
 
                       lines=None):
 
1278
                       lines=None, filter_tree_path=None):
1258
1279
        """Emit a single conflict file."""
1259
1280
        name = name + '.' + suffix
1260
1281
        trans_id = self.tt.create_path(name, parent_id)
1261
 
        create_from_tree(self.tt, trans_id, tree, file_id, lines)
 
1282
        create_from_tree(self.tt, trans_id, tree, file_id, lines,
 
1283
            filter_tree_path)
1262
1284
        return trans_id
1263
1285
 
1264
1286
    def merge_executable(self, file_id, file_status):