~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Andrew Bennetts
  • Date: 2009-12-03 05:57:41 UTC
  • mfrom: (4857 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4869.
  • Revision ID: andrew.bennetts@canonical.com-20091203055741-vmmg0fmjgjw2pwvu
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1150
1150
                self.tt.delete_contents(trans_id)
1151
1151
            if file_id in self.other_tree:
1152
1152
                # OTHER changed the file
 
1153
                wt = self.this_tree
 
1154
                if wt.supports_content_filtering():
 
1155
                    # We get the path from the working tree if it exists.
 
1156
                    # That fails though when OTHER is adding a file, so
 
1157
                    # we fall back to the other tree to find the path if
 
1158
                    # it doesn't exist locally.
 
1159
                    try:
 
1160
                        filter_tree_path = wt.id2path(file_id)
 
1161
                    except errors.NoSuchId:
 
1162
                        filter_tree_path = self.other_tree.id2path(file_id)
 
1163
                else:
 
1164
                    # Skip the id2path lookup for older formats
 
1165
                    filter_tree_path = None
1153
1166
                transform.create_from_tree(self.tt, trans_id,
1154
 
                                           self.other_tree, file_id)
 
1167
                                 self.other_tree, file_id,
 
1168
                                 filter_tree_path=filter_tree_path)
1155
1169
                if not file_in_this:
1156
1170
                    self.tt.version_file(file_id, trans_id)
1157
1171
                return "modified"
1244
1258
                ('THIS', self.this_tree, this_lines)]
1245
1259
        if not no_base:
1246
1260
            data.append(('BASE', self.base_tree, base_lines))
 
1261
 
 
1262
        # We need to use the actual path in the working tree of the file here,
 
1263
        # ignoring the conflict suffixes
 
1264
        wt = self.this_tree
 
1265
        if wt.supports_content_filtering():
 
1266
            try:
 
1267
                filter_tree_path = wt.id2path(file_id)
 
1268
            except errors.NoSuchId:
 
1269
                # file has been deleted
 
1270
                filter_tree_path = None
 
1271
        else:
 
1272
            # Skip the id2path lookup for older formats
 
1273
            filter_tree_path = None
 
1274
 
1247
1275
        versioned = False
1248
1276
        file_group = []
1249
1277
        for suffix, tree, lines in data:
1250
1278
            if file_id in tree:
1251
1279
                trans_id = self._conflict_file(name, parent_id, tree, file_id,
1252
 
                                               suffix, lines)
 
1280
                                               suffix, lines, filter_tree_path)
1253
1281
                file_group.append(trans_id)
1254
1282
                if set_version and not versioned:
1255
1283
                    self.tt.version_file(file_id, trans_id)
1257
1285
        return file_group
1258
1286
 
1259
1287
    def _conflict_file(self, name, parent_id, tree, file_id, suffix,
1260
 
                       lines=None):
 
1288
                       lines=None, filter_tree_path=None):
1261
1289
        """Emit a single conflict file."""
1262
1290
        name = name + '.' + suffix
1263
1291
        trans_id = self.tt.create_path(name, parent_id)
1264
 
        transform.create_from_tree(self.tt, trans_id, tree, file_id, lines)
 
1292
        transform.create_from_tree(self.tt, trans_id, tree, file_id, lines,
 
1293
            filter_tree_path)
1265
1294
        return trans_id
1266
1295
 
1267
1296
    def merge_executable(self, file_id, file_status):