~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: John Arbash Meinel
  • Date: 2008-10-30 00:55:00 UTC
  • mto: (3815.2.5 prepare-1.9)
  • mto: This revision was merged to the branch mainline in revision 3811.
  • Revision ID: john@arbash-meinel.com-20081030005500-r5cej1cxflqhs3io
Switch so that we are using a simple timestamp as the first action.

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
 
                import pdb; pdb.set_trace()
294
 
                self._basis_tree = self.branch.repository.revision_tree(None)
 
303
                self._basis_tree = self.branch.repository.revision_tree(
 
304
                                       _mod_revision.NULL_REVISION)
295
305
            else:
296
306
                self._basis_tree = parents_list[0][1]
297
307
            self._branch_revision_id = parents_list[0][0]