~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Patch Queue Manager
  • Date: 2012-01-03 16:52:03 UTC
  • mfrom: (6410.1.2 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120103165203-ni17x57ylfpli2j0
(jelmer) Distinguish between working tree and this tree in merge. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
764
764
            this_branch = this_tree.branch
765
765
        self.interesting_ids = interesting_ids
766
766
        self.interesting_files = interesting_files
767
 
        self.this_tree = working_tree
 
767
        self.working_tree = working_tree
 
768
        self.this_tree = this_tree
768
769
        self.base_tree = base_tree
769
770
        self.other_tree = other_tree
770
771
        self.this_branch = this_branch
790
791
 
791
792
    def do_merge(self):
792
793
        operation = cleanup.OperationWithCleanups(self._do_merge)
793
 
        self.this_tree.lock_tree_write()
 
794
        self.working_tree.lock_tree_write()
 
795
        operation.add_cleanup(self.working_tree.unlock)
 
796
        self.this_tree.lock_read()
794
797
        operation.add_cleanup(self.this_tree.unlock)
795
798
        self.base_tree.lock_read()
796
799
        operation.add_cleanup(self.base_tree.unlock)
799
802
        operation.run()
800
803
 
801
804
    def _do_merge(self, operation):
802
 
        self.tt = transform.TreeTransform(self.this_tree, None)
 
805
        self.tt = transform.TreeTransform(self.working_tree, None)
803
806
        operation.add_cleanup(self.tt.finalize)
804
807
        self._compute_transform()
805
808
        results = self.tt.apply(no_conflicts=True)
806
809
        self.write_modified(results)
807
810
        try:
808
 
            self.this_tree.add_conflicts(self.cooked_conflicts)
 
811
            self.working_tree.add_conflicts(self.cooked_conflicts)
809
812
        except errors.UnsupportedOperation:
810
813
            pass
811
814
 
818
821
        return operation.run_simple()
819
822
 
820
823
    def _make_preview_transform(self):
821
 
        self.tt = transform.TransformPreview(self.this_tree)
 
824
        self.tt = transform.TransformPreview(self.working_tree)
822
825
        self._compute_transform()
823
826
        return self.tt
824
827
 
1123
1126
    def write_modified(self, results):
1124
1127
        modified_hashes = {}
1125
1128
        for path in results.modified_paths:
1126
 
            file_id = self.this_tree.path2id(self.this_tree.relpath(path))
 
1129
            file_id = self.working_tree.path2id(self.working_tree.relpath(path))
1127
1130
            if file_id is None:
1128
1131
                continue
1129
 
            hash = self.this_tree.get_file_sha1(file_id)
 
1132
            hash = self.working_tree.get_file_sha1(file_id)
1130
1133
            if hash is None:
1131
1134
                continue
1132
1135
            modified_hashes[file_id] = hash
1133
 
        self.this_tree.set_merge_modified(modified_hashes)
 
1136
        self.working_tree.set_merge_modified(modified_hashes)
1134
1137
 
1135
1138
    @staticmethod
1136
1139
    def parent(entry, file_id):