/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: Marius Kruger
  • Date: 2007-08-12 08:15:15 UTC
  • mfrom: (2695 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2979.
  • Revision ID: amanic@gmail.com-20070812081515-vgekipfhohcuj6rn
merge with 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.
76
83
        """See Tree.get_file."""
77
84
        return self._file_transport.get(self.id2path(file_id))
78
85
 
79
 
    def get_file_sha1(self, file_id, path=None):
 
86
    def get_file_sha1(self, file_id, path=None, stat_value=None):
80
87
        """See Tree.get_file_sha1()."""
81
88
        if path is None:
82
89
            path = self.id2path(file_id)
83
90
        stream = self._file_transport.get(path)
84
91
        return sha_file(stream)
85
92
 
 
93
    def _comparison_data(self, entry, path):
 
94
        """See Tree._comparison_data."""
 
95
        if entry is None:
 
96
            return None, False, None
 
97
        return entry.kind, entry.executable, None
 
98
 
 
99
    def _file_size(self, entry, stat_value):
 
100
        """See Tree._file_size."""
 
101
        if entry is None:
 
102
            return 0
 
103
        return entry.text_size
 
104
 
86
105
    @needs_read_lock
87
106
    def get_parent_ids(self):
88
107
        """See Tree.get_parent_ids.
224
243
 
225
244
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
226
245
        """See MutableTree.set_parent_trees()."""
 
246
        for revision_id in revision_ids:
 
247
            _mod_revision.check_not_reserved_id(revision_id)
227
248
        if len(revision_ids) == 0:
228
249
            self._parent_ids = []
229
250
            self._basis_tree = self.branch.repository.revision_tree(None)
243
264
                # a ghost in the left most parent
244
265
                raise errors.GhostRevisionUnusableHere(parents_list[0][0])
245
266
            self._parent_ids = [parent_id for parent_id, tree in parents_list]
246
 
            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()
247
269
                self._basis_tree = self.branch.repository.revision_tree(None)
248
270
            else:
249
271
                self._basis_tree = parents_list[0][1]