~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: 2009-09-19 00:32:14 UTC
  • mfrom: (4685.2.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20090919003214-2dli9jc4y5xhjj3n
(mbp for garyvdm) Revert rename of
        test_merge_uncommitted_otherbasis_ancestor_of_thisbasis.

Show diffs side-by-side

added added

removed removed

Lines of Context:
613
613
        self.this_tree.lock_tree_write()
614
614
        self.base_tree.lock_read()
615
615
        self.other_tree.lock_read()
616
 
        self.tt = TreeTransform(self.this_tree, self.pb)
617
616
        try:
618
 
            self.pp.next_phase()
619
 
            self._compute_transform()
620
 
            self.pp.next_phase()
621
 
            results = self.tt.apply(no_conflicts=True)
622
 
            self.write_modified(results)
 
617
            self.tt = TreeTransform(self.this_tree, self.pb)
623
618
            try:
624
 
                self.this_tree.add_conflicts(self.cooked_conflicts)
625
 
            except UnsupportedOperation:
626
 
                pass
 
619
                self.pp.next_phase()
 
620
                self._compute_transform()
 
621
                self.pp.next_phase()
 
622
                results = self.tt.apply(no_conflicts=True)
 
623
                self.write_modified(results)
 
624
                try:
 
625
                    self.this_tree.add_conflicts(self.cooked_conflicts)
 
626
                except UnsupportedOperation:
 
627
                    pass
 
628
            finally:
 
629
                self.tt.finalize()
627
630
        finally:
628
 
            self.tt.finalize()
629
631
            self.other_tree.unlock()
630
632
            self.base_tree.unlock()
631
633
            self.this_tree.unlock()
1160
1162
                self.tt.delete_contents(trans_id)
1161
1163
            if file_id in self.other_tree:
1162
1164
                # OTHER changed the file
1163
 
                wt = self.this_tree
1164
 
                if wt.supports_content_filtering():
1165
 
                    filter_tree_path = self.other_tree.id2path(file_id)
1166
 
                else:
1167
 
                    # Skip the id2path lookup for older formats
1168
 
                    filter_tree_path = None
1169
1165
                create_from_tree(self.tt, trans_id,
1170
 
                                 self.other_tree, file_id,
1171
 
                                 filter_tree_path=filter_tree_path)
 
1166
                                 self.other_tree, file_id)
1172
1167
                if not file_in_this:
1173
1168
                    self.tt.version_file(file_id, trans_id)
1174
1169
                return "modified"
1261
1256
                ('THIS', self.this_tree, this_lines)]
1262
1257
        if not no_base:
1263
1258
            data.append(('BASE', self.base_tree, base_lines))
1264
 
 
1265
 
        # We need to use the actual path in the working tree of the file here,
1266
 
        # ignoring the conflict suffixes
1267
 
        wt = self.this_tree
1268
 
        if wt.supports_content_filtering():
1269
 
            try:
1270
 
                filter_tree_path = wt.id2path(file_id)
1271
 
            except errors.NoSuchId:
1272
 
                # file has been deleted
1273
 
                filter_tree_path = None
1274
 
        else:
1275
 
            # Skip the id2path lookup for older formats
1276
 
            filter_tree_path = None
1277
 
 
1278
1259
        versioned = False
1279
1260
        file_group = []
1280
1261
        for suffix, tree, lines in data:
1281
1262
            if file_id in tree:
1282
1263
                trans_id = self._conflict_file(name, parent_id, tree, file_id,
1283
 
                                               suffix, lines, filter_tree_path)
 
1264
                                               suffix, lines)
1284
1265
                file_group.append(trans_id)
1285
1266
                if set_version and not versioned:
1286
1267
                    self.tt.version_file(file_id, trans_id)
1288
1269
        return file_group
1289
1270
 
1290
1271
    def _conflict_file(self, name, parent_id, tree, file_id, suffix,
1291
 
                       lines=None, filter_tree_path=None):
 
1272
                       lines=None):
1292
1273
        """Emit a single conflict file."""
1293
1274
        name = name + '.' + suffix
1294
1275
        trans_id = self.tt.create_path(name, parent_id)
1295
 
        create_from_tree(self.tt, trans_id, tree, file_id, lines,
1296
 
            filter_tree_path)
 
1276
        create_from_tree(self.tt, trans_id, tree, file_id, lines)
1297
1277
        return trans_id
1298
1278
 
1299
1279
    def merge_executable(self, file_id, file_status):