~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-17 13:49:11 UTC
  • mfrom: (4988.11.1 imports)
  • Revision ID: pqm@pqm.ubuntu.com-20100217134911-s77se00ni7xc1hz8
(Jelmer) Remove some unused imports.

Show diffs side-by-side

added added

removed removed

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