/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 bzrlib/merge.py

  • Committer: Martin Pool
  • Date: 2011-06-28 13:55:39 UTC
  • mfrom: (5995 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5996.
  • Revision ID: mbp@canonical.com-20110628135539-6541falwx39fl46i
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
868
868
                    executable3, file_status, resolver=resolver)
869
869
        finally:
870
870
            child_pb.finished()
871
 
        self.fix_root()
 
871
        self.tt.fixup_new_roots()
872
872
        self._finish_computing_transform()
873
873
 
874
874
    def _finish_computing_transform(self):
1093
1093
                          ))
1094
1094
        return result
1095
1095
 
 
1096
    @deprecated_method(deprecated_in((2, 4, 0)))
1096
1097
    def fix_root(self):
1097
1098
        if self.tt.final_kind(self.tt.root) is None:
1098
1099
            self.tt.cancel_deletion(self.tt.root)
1316
1317
            self._raw_conflicts.append(('path conflict', trans_id, file_id,
1317
1318
                                        this_parent, this_name,
1318
1319
                                        other_parent, other_name))
1319
 
        if other_name is None:
 
1320
        if not self.other_tree.has_id(file_id):
1320
1321
            # it doesn't matter whether the result was 'other' or
1321
 
            # 'conflict'-- if there's no 'other', we leave it alone.
 
1322
            # 'conflict'-- if it has no file id, we leave it alone.
1322
1323
            return
1323
1324
        parent_id = parents[self.winner_idx[parent_id_winner]]
1324
 
        if parent_id is not None:
 
1325
        name = names[self.winner_idx[name_winner]]
 
1326
        if parent_id is not None or name is not None:
1325
1327
            # if we get here, name_winner and parent_winner are set to safe
1326
1328
            # values.
1327
 
            self.tt.adjust_path(names[self.winner_idx[name_winner]],
1328
 
                                self.tt.trans_id_file_id(parent_id),
 
1329
            if parent_id is None and name is not None:
 
1330
                # if parent_id is None and name is non-None, current file is
 
1331
                # the tree root.
 
1332
                if names[self.winner_idx[parent_id_winner]] != '':
 
1333
                    raise AssertionError(
 
1334
                        'File looks like a root, but named %s' %
 
1335
                        names[self.winner_idx[parent_id_winner]])
 
1336
                parent_trans_id = transform.ROOT_PARENT
 
1337
            else:
 
1338
                parent_trans_id = self.tt.trans_id_file_id(parent_id)
 
1339
            self.tt.adjust_path(name, parent_trans_id,
1329
1340
                                self.tt.trans_id_file_id(file_id))
1330
1341
 
1331
1342
    def _do_merge_contents(self, file_id):
1605
1616
 
1606
1617
    def cook_conflicts(self, fs_conflicts):
1607
1618
        """Convert all conflicts into a form that doesn't depend on trans_id"""
1608
 
        self.cooked_conflicts.extend(transform.cook_conflicts(
1609
 
                fs_conflicts, self.tt))
 
1619
        content_conflict_file_ids = set()
 
1620
        cooked_conflicts = transform.cook_conflicts(fs_conflicts, self.tt)
1610
1621
        fp = transform.FinalPaths(self.tt)
1611
1622
        for conflict in self._raw_conflicts:
1612
1623
            conflict_type = conflict[0]
1642
1653
                        break
1643
1654
                c = _mod_conflicts.Conflict.factory(conflict_type,
1644
1655
                                                    path=path, file_id=file_id)
 
1656
                content_conflict_file_ids.add(file_id)
1645
1657
            elif conflict_type == 'text conflict':
1646
1658
                trans_id = conflict[1]
1647
1659
                path = fp.get_path(trans_id)
1650
1662
                                                    path=path, file_id=file_id)
1651
1663
            else:
1652
1664
                raise AssertionError('bad conflict type: %r' % (conflict,))
 
1665
            cooked_conflicts.append(c)
 
1666
 
 
1667
        self.cooked_conflicts = []
 
1668
        # We want to get rid of path conflicts when a corresponding contents
 
1669
        # conflict exists. This can occur when one branch deletes a file while
 
1670
        # the other renames *and* modifies it. In this case, the content
 
1671
        # conflict is enough.
 
1672
        for c in cooked_conflicts:
 
1673
            if (c.typestring == 'path conflict'
 
1674
                and c.file_id in content_conflict_file_ids):
 
1675
                continue
1653
1676
            self.cooked_conflicts.append(c)
1654
1677
        self.cooked_conflicts.sort(key=_mod_conflicts.Conflict.sort_key)
1655
1678