~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

Merge bzr.dev

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.
236
243
 
237
244
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
238
245
        """See MutableTree.set_parent_trees()."""
 
246
        for revision_id in revision_ids:
 
247
            _mod_revision.check_not_reserved_id(revision_id)
239
248
        if len(revision_ids) == 0:
240
249
            self._parent_ids = []
241
250
            self._basis_tree = self.branch.repository.revision_tree(None)
255
264
                # a ghost in the left most parent
256
265
                raise errors.GhostRevisionUnusableHere(parents_list[0][0])
257
266
            self._parent_ids = [parent_id for parent_id, tree in parents_list]
258
 
            if parents_list[0][1] is None:
 
267
            if parents_list[0][1] is None or parents_list[0][1] == 'null:':
 
268
                import pdb; pdb.set_trace()
259
269
                self._basis_tree = self.branch.repository.revision_tree(None)
260
270
            else:
261
271
                self._basis_tree = parents_list[0][1]