~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-26 08:05:45 UTC
  • mfrom: (5916 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5917.
  • Revision ID: john@arbash-meinel.com-20110526080545-5tprxfczyj4bfk0o
Merge bzr.dev 5916 and make sure the right patch is applied.

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):
1171
1193
 
1172
1194
    def unlock(self):
1173
1195
        """Unlock in format 4 trees needs to write the entire dirstate."""
1174
 
        # do non-implementation specific cleanup
1175
 
        self._cleanup()
1176
 
 
1177
1196
        if self._control_files._lock_count == 1:
 
1197
            # do non-implementation specific cleanup
 
1198
            self._cleanup()
 
1199
 
1178
1200
            # eventually we should do signature checking during read locks for
1179
1201
            # dirstate updates.
1180
1202
            if self._control_files._lock_mode == 'w':
1453
1475
        """See WorkingTreeFormat.initialize().
1454
1476
 
1455
1477
        :param revision_id: allows creating a working tree at a different
1456
 
        revision than the branch is at.
 
1478
            revision than the branch is at.
1457
1479
        :param accelerator_tree: A tree which can be used for retrieving file
1458
1480
            contents more quickly than the revision tree, i.e. a workingtree.
1459
1481
            The revision tree will be used for cases where accelerator_tree's