~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: Andrew Bennetts
  • Date: 2009-04-02 05:53:12 UTC
  • mto: This revision was merged to the branch mainline in revision 4242.
  • Revision ID: andrew.bennetts@canonical.com-20090402055312-h7mvgumvm7e620mj
Fix nits in spelling and naming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
"""
21
21
 
22
22
 
 
23
from copy import deepcopy
23
24
import os
24
25
 
25
26
from bzrlib import (
26
27
    errors,
27
28
    mutabletree,
 
29
    osutils,
28
30
    revision as _mod_revision,
29
31
    )
30
 
from bzrlib.decorators import needs_read_lock
31
 
from bzrlib.inventory import Inventory
 
32
from bzrlib.decorators import needs_read_lock, needs_write_lock
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):
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
50
51
        self._locks = 0
51
52
        self._lock_mode = None
52
53
 
53
 
    def is_control_filename(self, filename):
54
 
        # Memory tree doesn't have any control filenames
55
 
        return False
56
 
 
57
54
    @needs_tree_write_lock
58
55
    def _add(self, files, ids, kinds):
59
56
        """See MutableTree._add."""
220
217
            self._parent_ids = []
221
218
        else:
222
219
            self._parent_ids = [self._branch_revision_id]
223
 
        self._inventory = Inventory(None, self._basis_tree.get_revision_id())
 
220
        self._inventory = deepcopy(self._basis_tree._inventory)
224
221
        self._file_transport = MemoryTransport()
225
222
        # TODO copy the revision trees content, or do it lazy, or something.
226
 
        inventory_entries = self._basis_tree.iter_entries_by_dir()
 
223
        inventory_entries = self._inventory.iter_entries()
227
224
        for path, entry in inventory_entries:
228
 
            self._inventory.add(entry.copy())
229
225
            if path == '':
230
226
                continue
231
227
            if entry.kind == 'directory':