~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-29 23:51:44 UTC
  • mfrom: (3363.17.14 merge-into)
  • Revision ID: pqm@pqm.ubuntu.com-20080929235144-2jweo1007kh31723
Enable merging into PreviewTrees

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
 
173
173
    @staticmethod
174
174
    def from_revision_ids(pb, tree, other, base=None, other_branch=None,
175
 
                          base_branch=None, revision_graph=None):
 
175
                          base_branch=None, revision_graph=None,
 
176
                          tree_branch=None):
176
177
        """Return a Merger for revision-ids.
177
178
 
178
179
        :param tree: The tree to merge changes into
187
188
            it in, otherwise it will be created for you.
188
189
        :param pb: A progress indicator
189
190
        """
190
 
        merger = Merger(tree.branch, this_tree=tree, pb=pb,
 
191
        if tree_branch is None:
 
192
            tree_branch = tree.branch
 
193
        merger = Merger(tree_branch, this_tree=tree, pb=pb,
191
194
                        revision_graph=revision_graph)
192
195
        if other_branch is None:
193
196
            other_branch = tree.branch
668
671
        iterator = self.other_tree.iter_changes(self.base_tree,
669
672
                include_unchanged=True, specific_files=self.interesting_files,
670
673
                extra_trees=[self.this_tree])
 
674
        this_entries = dict((e.file_id, e) for p, e in
 
675
                            self.this_tree.iter_entries_by_dir(
 
676
                            self.interesting_ids))
671
677
        for (file_id, paths, changed, versioned, parents, names, kind,
672
678
             executable) in iterator:
673
679
            if (self.interesting_ids is not None and
674
680
                file_id not in self.interesting_ids):
675
681
                continue
676
 
            if file_id in self.this_tree.inventory:
677
 
                entry = self.this_tree.inventory[file_id]
 
682
            entry = this_entries.get(file_id)
 
683
            if entry is not None:
678
684
                this_name = entry.name
679
685
                this_parent = entry.parent_id
680
686
                this_executable = entry.executable
1125
1131
                    self.tt.delete_contents(trans_id)
1126
1132
                if file_id in self.other_tree:
1127
1133
                    # OTHER changed the file
1128
 
                    create_by_entry(self.tt, 
1129
 
                                    self.other_tree.inventory[file_id], 
 
1134
                    create_by_entry(self.tt,
 
1135
                                    self.other_tree.inventory[file_id],
1130
1136
                                    self.other_tree, trans_id)
1131
 
                    if file_id not in self.this_tree.inventory:
 
1137
                    if file_id not in self.this_tree:
1132
1138
                        self.tt.version_file(file_id, trans_id)
1133
1139
                    return "modified"
1134
1140
                elif file_id in self.this_tree.inventory:
1144
1150
                    self.text_merge(file_id, trans_id)
1145
1151
                except BinaryFile:
1146
1152
                    return contents_conflict()
1147
 
                if file_id not in self.this_tree.inventory:
 
1153
                if file_id not in self.this_tree:
1148
1154
                    self.tt.version_file(file_id, trans_id)
1149
1155
                try:
1150
1156
                    self.tt.tree_kind(trans_id)