~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-22 14:12:18 UTC
  • mfrom: (6155.3.1 jam)
  • Revision ID: pqm@pqm.ubuntu.com-20110922141218-86s4uu6nqvourw4f
(jameinel) Cleanup comments bzrlib/smart/__init__.py (John A Meinel)

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