~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-24 00:16:15 UTC
  • mto: This revision was merged to the branch mainline in revision 6464.
  • Revision ID: jelmer@samba.org-20120124001615-ru3uwevs9d48kxcn
Add root_inventory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1946
1946
            if entry.parent_id == orig_root_id:
1947
1947
                entry.parent_id = inv.root.file_id
1948
1948
 
1949
 
    def all_file_ids(self):
1950
 
        """See Tree.iter_all_file_ids"""
1951
 
        return set(self.inventory)
1952
 
 
1953
1949
    @needs_tree_write_lock
1954
1950
    def set_parent_trees(self, parents_list, allow_leftmost_as_ghost=False):
1955
1951
        """See MutableTree.set_parent_trees."""
2084
2080
        return osutils.lexists(self.abspath(path))
2085
2081
 
2086
2082
    def has_or_had_id(self, file_id):
2087
 
        if file_id == self.inventory.root.file_id:
 
2083
        if file_id == self.root_inventory.root.file_id:
2088
2084
            return True
2089
2085
        inv, inv_file_id = self._unpack_file_id(file_id)
2090
2086
        return inv.has_id(inv_file_id)
2222
2218
        # should probably put it back with the previous ID.
2223
2219
        # the read and write working inventory should not occur in this
2224
2220
        # function - they should be part of lock_write and unlock.
2225
 
        inv = self.inventory
 
2221
        # FIXME: nested trees
 
2222
        inv = self.root_inventory
2226
2223
        for f, file_id, kind in zip(files, ids, kinds):
2227
2224
            if file_id is None:
2228
2225
                inv.add_path(f, kind=kind)
2758
2755
 
2759
2756
        Also does basic plausability tests.
2760
2757
        """
2761
 
        inv = self.inventory
 
2758
        # FIXME: Handling of nested trees
 
2759
        inv = self.root_inventory
2762
2760
 
2763
2761
        for rename_entry in rename_entries:
2764
2762
            # store to local variables for easier reference
2822
2820
        Depending on the value of the flag 'only_change_inv', the
2823
2821
        file will be moved on the file system or not.
2824
2822
        """
2825
 
        inv = self.inventory
2826
2823
        moved = []
2827
2824
 
2828
2825
        for entry in rename_entries:
2850
2847
                        " Error message is: %s" % e)
2851
2848
 
2852
2849
    def _move_entry(self, entry):
2853
 
        inv = self.inventory
 
2850
        inv = self.root_inventory
2854
2851
        from_rel_abs = self.abspath(entry.from_rel)
2855
2852
        to_rel_abs = self.abspath(entry.to_rel)
2856
2853
        if from_rel_abs == to_rel_abs:
2897
2894
 
2898
2895
    def stored_kind(self, file_id):
2899
2896
        """See Tree.stored_kind"""
2900
 
        return self.inventory[file_id].kind
 
2897
        inv, inv_file_id = self._unpack_file_id(file_id)
 
2898
        return inv[inv_file_id].kind
2901
2899
 
2902
2900
    def extras(self):
2903
2901
        """Yield all unversioned files in this WorkingTree.
2910
2908
        This is the same order used by 'osutils.walkdirs'.
2911
2909
        """
2912
2910
        ## TODO: Work from given directory downwards
2913
 
        for path, dir_entry in self.inventory.directories():
 
2911
        for path, dir_entry in self.root_inventory.directories():
2914
2912
            # mutter("search for unknowns in %r", path)
2915
2913
            dirabs = self.abspath(path)
2916
2914
            if not isdir(dirabs):
2953
2951
        """
2954
2952
        _directory = 'directory'
2955
2953
        # get the root in the inventory
2956
 
        inv = self.inventory
2957
 
        top_id = inv.path2id(prefix)
 
2954
        inv, top_id = self._path2inv_file_id(prefix)
2958
2955
        if top_id is None:
2959
2956
            pending = []
2960
2957
        else: