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

  • Committer: Ian Clatworthy
  • Date: 2008-12-15 06:18:29 UTC
  • mfrom: (3905 +trunk)
  • mto: (3586.1.23 views-ui)
  • mto: This revision was merged to the branch mainline in revision 4030.
  • Revision ID: ian.clatworthy@canonical.com-20081215061829-c8qwa93g71u9fsh5
merge bzr.dev 3905

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
 
23
23
from copy import deepcopy
 
24
import os
24
25
 
25
26
from bzrlib import (
26
27
    errors,
27
28
    mutabletree,
 
29
    osutils,
28
30
    revision as _mod_revision,
29
31
    )
30
32
from bzrlib.decorators import needs_read_lock, needs_write_lock
68
70
    def create_on_branch(branch):
69
71
        """Create a MemoryTree for branch, using the last-revision of branch."""
70
72
        revision_id = _mod_revision.ensure_null(branch.last_revision())
71
 
        if _mod_revision.is_null(revision_id):
72
 
            revision_id = None
73
73
        return MemoryTree(branch, revision_id)
74
74
 
75
75
    def _gather_kinds(self, files, kinds):
101
101
            return None, False, None
102
102
        return entry.kind, entry.executable, None
103
103
 
 
104
    @needs_tree_write_lock
 
105
    def rename_one(self, from_rel, to_rel):
 
106
        file_id = self.path2id(from_rel)
 
107
        to_dir, to_tail = os.path.split(to_rel)
 
108
        to_parent_id = self.path2id(to_dir)
 
109
        self._file_transport.move(from_rel, to_rel)
 
110
        self._inventory.rename(file_id, to_parent_id, to_tail)
 
111
 
104
112
    def path_content_summary(self, path):
105
113
        """See Tree.path_content_summary."""
106
114
        id = self.path2id(path)
206
214
        """Populate the in-tree state from the branch."""
207
215
        self._basis_tree = self.branch.repository.revision_tree(
208
216
            self._branch_revision_id)
209
 
        if self._branch_revision_id is None:
 
217
        if self._branch_revision_id == _mod_revision.NULL_REVISION:
210
218
            self._parent_ids = []
211
219
        else:
212
220
            self._parent_ids = [self._branch_revision_id]
272
280
            _mod_revision.check_not_reserved_id(revision_id)
273
281
        if len(revision_ids) == 0:
274
282
            self._parent_ids = []
275
 
            self._basis_tree = self.branch.repository.revision_tree(None)
 
283
            self._basis_tree = self.branch.repository.revision_tree(
 
284
                                    _mod_revision.NULL_REVISION)
276
285
        else:
277
286
            self._parent_ids = revision_ids
278
287
            self._basis_tree = self.branch.repository.revision_tree(
283
292
        """See MutableTree.set_parent_trees()."""
284
293
        if len(parents_list) == 0:
285
294
            self._parent_ids = []
286
 
            self._basis_tree = self.branch.repository.revision_tree(None)
 
295
            self._basis_tree = self.branch.repository.revision_tree(
 
296
                                   _mod_revision.NULL_REVISION)
287
297
        else:
288
298
            if parents_list[0][1] is None and not allow_leftmost_as_ghost:
289
299
                # a ghost in the left most parent
290
300
                raise errors.GhostRevisionUnusableHere(parents_list[0][0])
291
301
            self._parent_ids = [parent_id for parent_id, tree in parents_list]
292
302
            if parents_list[0][1] is None or parents_list[0][1] == 'null:':
293
 
                self._basis_tree = self.branch.repository.revision_tree(None)
 
303
                self._basis_tree = self.branch.repository.revision_tree(
 
304
                                       _mod_revision.NULL_REVISION)
294
305
            else:
295
306
                self._basis_tree = parents_list[0][1]
296
307
            self._branch_revision_id = parents_list[0][0]