~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-13 16:23:07 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: john@arbash-meinel.com-20100113162307-0bs82td16gzih827
Update the MANIFEST.in file.

Show diffs side-by-side

added added

removed removed

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