/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/workingtree_4.py

Update to bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        # if branch is at our basedir and is a format 6 or less
139
139
        # assume all other formats have their own control files.
140
140
        self._control_files = _control_files
 
141
        self._transport = self._control_files._transport
141
142
        self._dirty = None
142
143
        #-------------
143
144
        # during a read or write lock these objects are set, and are
1084
1085
                raise errors.GhostRevisionUnusableHere(parents_list[0][0])
1085
1086
        real_trees = []
1086
1087
        ghosts = []
 
1088
 
 
1089
        parent_ids = [rev_id for rev_id, tree in parents_list]
 
1090
        graph = self.branch.repository.get_graph()
 
1091
        heads = graph.heads(parent_ids)
 
1092
        accepted_revisions = set()
 
1093
 
1087
1094
        # convert absent trees to the null tree, which we convert back to
1088
1095
        # missing on access.
1089
1096
        for rev_id, tree in parents_list:
 
1097
            if len(accepted_revisions) > 0:
 
1098
                # we always accept the first tree
 
1099
                if rev_id in accepted_revisions or rev_id not in heads:
 
1100
                    # We have already included either this tree, or its
 
1101
                    # descendent, so we skip it.
 
1102
                    continue
1090
1103
            _mod_revision.check_not_reserved_id(rev_id)
1091
1104
            if tree is not None:
1092
1105
                real_trees.append((rev_id, tree))
1094
1107
                real_trees.append((rev_id,
1095
1108
                    self.branch.repository.revision_tree(None)))
1096
1109
                ghosts.append(rev_id)
 
1110
            accepted_revisions.add(rev_id)
1097
1111
        dirstate.set_parent_trees(real_trees, ghosts=ghosts)
1098
1112
        self._make_dirty(reset_inventory=False)
1099
1113
 
1307
1321
        control_files = self._open_control_files(a_bzrdir)
1308
1322
        control_files.create_lock()
1309
1323
        control_files.lock_write()
1310
 
        control_files.put_utf8('format', self.get_format_string())
 
1324
        transport.put_bytes('format', self.get_format_string(),
 
1325
            mode=a_bzrdir._get_file_mode())
1311
1326
        if from_branch is not None:
1312
1327
            branch = from_branch
1313
1328
        else:
1358
1373
                if basis_root_id is not None:
1359
1374
                    wt._set_root_id(basis_root_id)
1360
1375
                    wt.flush()
 
1376
                # delta_from_tree is safe even for DirStateRevisionTrees,
 
1377
                # because wt4.apply_inventory_delta does not mutate the input
 
1378
                # inventory entries.
1361
1379
                transform.build_tree(basis, wt, accelerator_tree,
1362
 
                                     hardlink=hardlink)
 
1380
                                     hardlink=hardlink, delta_from_tree=True)
1363
1381
            finally:
1364
1382
                basis.unlock()
1365
1383
        finally:
2527
2545
 
2528
2546
    def update_format(self, tree):
2529
2547
        """Change the format marker."""
2530
 
        tree._control_files.put_utf8('format',
2531
 
            self.target_format.get_format_string())
 
2548
        tree._transport.put_bytes('format',
 
2549
            self.target_format.get_format_string(),
 
2550
            mode=tree.bzrdir._get_file_mode())