~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/memorytree.py

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

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,
29
28
    revision as _mod_revision,
30
29
    )
31
 
from bzrlib.decorators import needs_read_lock, needs_write_lock
 
30
from bzrlib.decorators import needs_read_lock
 
31
from bzrlib.inventory import Inventory
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.MutableTree):
 
37
class MemoryTree(mutabletree.MutableInventoryTree):
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
 
53
57
    @needs_tree_write_lock
54
58
    def _add(self, files, ids, kinds):
55
59
        """See MutableTree._add."""
216
220
            self._parent_ids = []
217
221
        else:
218
222
            self._parent_ids = [self._branch_revision_id]
219
 
        self._inventory = self._basis_tree._inventory._get_mutable_inventory()
 
223
        self._inventory = Inventory(None, self._basis_tree.get_revision_id())
220
224
        self._file_transport = MemoryTransport()
221
225
        # TODO copy the revision trees content, or do it lazy, or something.
222
 
        inventory_entries = self._inventory.iter_entries()
 
226
        inventory_entries = self._basis_tree.iter_entries_by_dir()
223
227
        for path, entry in inventory_entries:
 
228
            self._inventory.add(entry.copy())
224
229
            if path == '':
225
230
                continue
226
231
            if entry.kind == 'directory':