~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-13 00:26:41 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101013002641-9tlh9k89mlj1666m
Keep docs-plain working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    revision as _mod_revision,
29
29
    )
30
30
from bzrlib.decorators import needs_read_lock
31
 
from bzrlib.inventory import Inventory
32
31
from bzrlib.osutils import sha_file
33
32
from bzrlib.mutabletree import needs_tree_write_lock
34
33
from bzrlib.transport.memory import MemoryTransport
35
34
 
36
35
 
37
 
class MemoryTree(mutabletree.MutableInventoryTree):
 
36
class MemoryTree(mutabletree.MutableTree):
38
37
    """A MemoryTree is a specialisation of MutableTree.
39
38
 
40
39
    It maintains nearly no state outside of read_lock and write_lock
50
49
        self._locks = 0
51
50
        self._lock_mode = None
52
51
 
53
 
    def is_control_filename(self, filename):
54
 
        # Memory tree doesn't have any control filenames
55
 
        return False
56
 
 
57
52
    @needs_tree_write_lock
58
53
    def _add(self, files, ids, kinds):
59
54
        """See MutableTree._add."""
220
215
            self._parent_ids = []
221
216
        else:
222
217
            self._parent_ids = [self._branch_revision_id]
223
 
        self._inventory = Inventory(None, self._basis_tree.get_revision_id())
 
218
        self._inventory = self._basis_tree._inventory._get_mutable_inventory()
224
219
        self._file_transport = MemoryTransport()
225
220
        # TODO copy the revision trees content, or do it lazy, or something.
226
 
        inventory_entries = self._basis_tree.iter_entries_by_dir()
 
221
        inventory_entries = self._inventory.iter_entries()
227
222
        for path, entry in inventory_entries:
228
 
            self._inventory.add(entry.copy())
229
223
            if path == '':
230
224
                continue
231
225
            if entry.kind == 'directory':