~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Vincent Ladeuil
  • Date: 2011-10-26 16:58:18 UTC
  • mto: (6015.44.4 2.4)
  • mto: This revision was merged to the branch mainline in revision 6236.
  • Revision ID: v.ladeuil+lp@free.fr-20111026165818-1nc3t9spcxogzb7c
Fix the other half by also producing a conflict but rely on merge to create the appropriate content. This covers the case where a file is modified in THIS but replaced in OTHER

Show diffs side-by-side

added added

removed removed

Lines of Context:
1392
1392
        keep_this = False
1393
1393
        result = "modified"
1394
1394
        if hook_status == 'not_applicable':
 
1395
            # No merge hook was able to resolve the situation. Two cases exist:
 
1396
            # a content conflict or a duplicate one.
1395
1397
            result = None
1396
1398
            name = self.tt.final_name(trans_id)
1397
1399
            parent_id = self.tt.final_parent(trans_id)
1398
1400
            duplicate = False
1399
 
            this_kind = this_pair[0]
1400
 
            if this_kind is None: # file_id is not in this
 
1401
            inhibit_content_conflict = False
 
1402
            if params.this_kind is None: # file_id is not in THIS
1401
1403
                # Is the name used for a different file_id ?
1402
1404
                dupe_path = self.other_tree.id2path(file_id)
1403
1405
                this_id = self.this_tree.path2id(dupe_path)
1404
 
                duplicate = this_id is not None
1405
 
            if duplicate:
1406
 
                # Two entries for the same path
1407
 
                keep_this = True
1408
 
                # versioning the merged file will trigger a duplicate conflict
1409
 
                self.tt.version_file(file_id, trans_id)
1410
 
                transform.create_from_tree(
1411
 
                    self.tt, trans_id, self.other_tree, file_id,
1412
 
                    filter_tree_path=self._get_filter_tree_path(file_id))
1413
 
            else:
1414
 
                if this_kind is not None:
 
1406
                if this_id is not None:
 
1407
                    # Two entries for the same path
 
1408
                    keep_this = True
 
1409
                    # versioning the merged file will trigger a duplicate
 
1410
                    # conflict
 
1411
                    self.tt.version_file(file_id, trans_id)
 
1412
                    transform.create_from_tree(
 
1413
                        self.tt, trans_id, self.other_tree, file_id,
 
1414
                        filter_tree_path=self._get_filter_tree_path(file_id))
 
1415
                    inhibit_content_conflict = True
 
1416
            elif params.other_kind is None: # file_id is not in OTHER
 
1417
                # Is the name used for a different file_id ?
 
1418
                dupe_path = self.this_tree.id2path(file_id)
 
1419
                other_id = self.other_tree.path2id(dupe_path)
 
1420
                if other_id is not None:
 
1421
                    # Two entries for the same path again, but here, the other
 
1422
                    # entry will also be merged.  We simply inhibit the
 
1423
                    # 'content' conflict creation because we know OTHER will
 
1424
                    # create (or has already created depending on ordering) an
 
1425
                    # entry at the same path. This will trigger a 'duplicate'
 
1426
                    # conflict later.
 
1427
                    keep_this = True
 
1428
                    inhibit_content_conflict = True
 
1429
            if not inhibit_content_conflict:
 
1430
                if params.this_kind is not None:
1415
1431
                    self.tt.unversion_file(trans_id)
1416
1432
                # This is a contents conflict, because none of the available
1417
1433
                # functions could merge it.