~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: Vincent Ladeuil
  • Date: 2007-07-15 11:24:18 UTC
  • mfrom: (2617 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070715112418-9nn4n6esxv60ny4b
merge bzr.dev@1617

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from copy import deepcopy
24
24
 
25
 
from bzrlib import errors, mutabletree
 
25
from bzrlib import (
 
26
    errors,
 
27
    mutabletree,
 
28
    revision as _mod_revision,
 
29
    )
26
30
from bzrlib.decorators import needs_read_lock, needs_write_lock
27
31
from bzrlib.osutils import sha_file
28
32
from bzrlib.mutabletree import needs_tree_write_lock
63
67
    @staticmethod
64
68
    def create_on_branch(branch):
65
69
        """Create a MemoryTree for branch, using the last-revision of branch."""
66
 
        return MemoryTree(branch, branch.last_revision())
 
70
        revision_id = _mod_revision.ensure_null(branch.last_revision())
 
71
        if _mod_revision.is_null(revision_id):
 
72
            revision_id = None
 
73
        return MemoryTree(branch, revision_id)
67
74
 
68
75
    def _gather_kinds(self, files, kinds):
69
76
        """See MutableTree._gather_kinds.
224
231
 
225
232
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
226
233
        """See MutableTree.set_parent_trees()."""
 
234
        for revision_id in revision_ids:
 
235
            _mod_revision.check_not_reserved_id(revision_id)
227
236
        if len(revision_ids) == 0:
228
237
            self._parent_ids = []
229
238
            self._basis_tree = self.branch.repository.revision_tree(None)
243
252
                # a ghost in the left most parent
244
253
                raise errors.GhostRevisionUnusableHere(parents_list[0][0])
245
254
            self._parent_ids = [parent_id for parent_id, tree in parents_list]
246
 
            if parents_list[0][1] is None:
 
255
            if parents_list[0][1] is None or parents_list[0][1] == 'null:':
 
256
                import pdb; pdb.set_trace()
247
257
                self._basis_tree = self.branch.repository.revision_tree(None)
248
258
            else:
249
259
                self._basis_tree = parents_list[0][1]