~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

(jameinel) (bug #780544) when updating the WT,
 allow it to be done with a fast delta,
 rather than setting the state from scratch. (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1145
1145
                        _mod_revision.NULL_REVISION)))
1146
1146
                ghosts.append(rev_id)
1147
1147
            accepted_revisions.add(rev_id)
1148
 
        dirstate.set_parent_trees(real_trees, ghosts=ghosts)
 
1148
        updated = False
 
1149
        if (len(real_trees) == 1
 
1150
            and not ghosts
 
1151
            and self.branch.repository._format.fast_deltas
 
1152
            and isinstance(real_trees[0][1],
 
1153
                revisiontree.InventoryRevisionTree)
 
1154
            and self.get_parent_ids()):
 
1155
            rev_id, rev_tree = real_trees[0]
 
1156
            basis_id = self.get_parent_ids()[0]
 
1157
            # There are times when basis_tree won't be in
 
1158
            # self.branch.repository, (switch, for example)
 
1159
            try:
 
1160
                basis_tree = self.branch.repository.revision_tree(basis_id)
 
1161
            except errors.NoSuchRevision:
 
1162
                # Fall back to the set_parent_trees(), since we can't use
 
1163
                # _make_delta if we can't get the RevisionTree
 
1164
                pass
 
1165
            else:
 
1166
                delta = rev_tree.inventory._make_delta(basis_tree.inventory)
 
1167
                dirstate.update_basis_by_delta(delta, rev_id)
 
1168
                updated = True
 
1169
        if not updated:
 
1170
            dirstate.set_parent_trees(real_trees, ghosts=ghosts)
1149
1171
        self._make_dirty(reset_inventory=False)
1150
1172
 
1151
1173
    def _set_root_id(self, file_id):