~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    errors,
27
27
    mutabletree,
28
28
    revision as _mod_revision,
 
29
    revisiontree,
 
30
    tree,
29
31
    )
30
32
from bzrlib.decorators import needs_read_lock
31
 
from bzrlib.inventory import Inventory
32
33
from bzrlib.osutils import sha_file
33
34
from bzrlib.mutabletree import needs_tree_write_lock
34
35
from bzrlib.transport.memory import MemoryTransport
35
36
 
36
37
 
37
 
class MemoryTree(mutabletree.MutableInventoryTree):
 
38
class MemoryTree(mutabletree.MutableTree,tree.InventoryTree):
38
39
    """A MemoryTree is a specialisation of MutableTree.
39
40
 
40
41
    It maintains nearly no state outside of read_lock and write_lock
220
221
            self._parent_ids = []
221
222
        else:
222
223
            self._parent_ids = [self._branch_revision_id]
223
 
        self._inventory = Inventory(None, self._basis_tree.get_revision_id())
 
224
        self._inventory = self._basis_tree._inventory._get_mutable_inventory()
224
225
        self._file_transport = MemoryTransport()
225
226
        # TODO copy the revision trees content, or do it lazy, or something.
226
 
        inventory_entries = self._basis_tree.iter_entries_by_dir()
 
227
        inventory_entries = self._inventory.iter_entries()
227
228
        for path, entry in inventory_entries:
228
 
            self._inventory.add(entry.copy())
229
229
            if path == '':
230
230
                continue
231
231
            if entry.kind == 'directory':