~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-07 00:57:24 UTC
  • mfrom: (6405.2.18 bzr)
  • Revision ID: pqm@pqm.ubuntu.com-20120207005724-xvfawh5exf1ohusu
(jelmer) Rename Tree.inventory to Tree.root_inventory. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    realpath,
69
69
    safe_unicode,
70
70
    )
 
71
from bzrlib.symbol_versioning import (
 
72
    deprecated_in,
 
73
    deprecated_method,
 
74
    )
71
75
from bzrlib.transport.local import LocalTransport
72
76
from bzrlib.tree import (
73
77
    InterTree,
414
418
                return link_or_sha1
415
419
        return None
416
420
 
417
 
    def _get_inventory(self):
 
421
    def _get_root_inventory(self):
418
422
        """Get the inventory for the tree. This is only valid within a lock."""
419
423
        if 'evil' in debug.debug_flags:
420
424
            trace.mutter_callsite(2,
425
429
        self._generate_inventory()
426
430
        return self._inventory
427
431
 
 
432
    @deprecated_method(deprecated_in((2, 5, 0)))
 
433
    def _get_inventory(self):
 
434
        return self.root_inventory
 
435
 
428
436
    inventory = property(_get_inventory,
429
437
                         doc="Inventory of this Tree")
430
438
 
 
439
    root_inventory = property(_get_root_inventory,
 
440
        "Root inventory of this tree")
 
441
 
431
442
    @needs_read_lock
432
443
    def get_parent_ids(self):
433
444
        """See Tree.get_parent_ids.
680
691
 
681
692
        if self._inventory is not None:
682
693
            update_inventory = True
683
 
            inv = self.inventory
 
694
            inv = self.root_inventory
684
695
            to_dir_id = to_entry[0][2]
685
696
            to_dir_ie = inv[to_dir_id]
686
697
        else:
1035
1046
 
1036
1047
        This is a meaningless operation for dirstate, but we obey it anyhow.
1037
1048
        """
1038
 
        return self.inventory
 
1049
        return self.root_inventory
1039
1050
 
1040
1051
    @needs_read_lock
1041
1052
    def revision_tree(self, revision_id):
1149
1160
                # _make_delta if we can't get the RevisionTree
1150
1161
                pass
1151
1162
            else:
1152
 
                delta = rev_tree.inventory._make_delta(
1153
 
                    basis_tree.inventory)
 
1163
                delta = rev_tree.root_inventory._make_delta(
 
1164
                    basis_tree.root_inventory)
1154
1165
                dirstate.update_basis_by_delta(delta, rev_id)
1155
1166
                updated = True
1156
1167
        if not updated:
1327
1338
        # being created.
1328
1339
        self._inventory = None
1329
1340
        # generate a delta,
1330
 
        delta = inv._make_delta(self.inventory)
 
1341
        delta = inv._make_delta(self.root_inventory)
1331
1342
        # and apply it.
1332
1343
        self.apply_inventory_delta(delta)
1333
1344
        if had_inventory:
1353
1364
            base_tree = trees[0][1]
1354
1365
        state = self.current_dirstate()
1355
1366
        # We don't support ghosts yet
1356
 
        state.set_state_from_scratch(base_tree.inventory, trees, [])
 
1367
        state.set_state_from_scratch(base_tree.root_inventory, trees, [])
1357
1368
 
1358
1369
 
1359
1370
class ContentFilterAwareSHA1Provider(dirstate.SHA1Provider):
1919
1930
        """Return the revision id for this tree."""
1920
1931
        return self._revision_id
1921
1932
 
1922
 
    def _get_inventory(self):
 
1933
    def _get_root_inventory(self):
1923
1934
        if self._inventory is not None:
1924
1935
            return self._inventory
1925
1936
        self._must_be_locked()
1926
1937
        self._generate_inventory()
1927
1938
        return self._inventory
1928
1939
 
 
1940
    root_inventory = property(_get_root_inventory,
 
1941
                         doc="Inventory of this Tree")
 
1942
 
 
1943
    @deprecated_method(deprecated_in((2, 5, 0)))
 
1944
    def _get_inventory(self):
 
1945
        return self.root_inventory
 
1946
 
1929
1947
    inventory = property(_get_inventory,
1930
1948
                         doc="Inventory of this Tree")
1931
1949
 
1975
1993
        # We use a standard implementation, because DirStateRevisionTree is
1976
1994
        # dealing with one of the parents of the current state
1977
1995
        if from_dir is None:
1978
 
            inv = self.inventory
 
1996
            inv = self.root_inventory
1979
1997
            from_dir_id = None
1980
1998
        else:
1981
1999
            inv, from_dir_id = self._path2inv_file_id(from_dir)
1982
2000
            if from_dir_id is None:
1983
2001
                # Directory not versioned
1984
2002
                return
 
2003
        # FIXME: Support nested trees
1985
2004
        entries = inv.iter_entries(from_dir=from_dir_id, recursive=recursive)
1986
2005
        if inv.root is not None and not include_root and from_dir is None:
1987
2006
            entries.next()
2037
2056
        # So for now, we just build up the parent inventory, and extract
2038
2057
        # it the same way RevisionTree does.
2039
2058
        _directory = 'directory'
2040
 
        inv = self._get_inventory()
 
2059
        inv = self._get_root_inventory()
2041
2060
        top_id = inv.path2id(prefix)
2042
2061
        if top_id is None:
2043
2062
            pending = []