/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to object_store.py

Defer invshamap calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
        inv = self.repository.get_inventory(revid)
119
119
        rev = self.repository.get_revision(revid)
120
120
        unusual_modes = extract_unusual_modes(rev)
121
 
        tree_sha = self._get_ie_sha1(inv.root, inv, unusual_modes)
 
121
        invshamap = self._idmap.get_inventory_sha_map(revid)
 
122
        tree_sha = self._get_ie_sha1(inv.root, inv, invshamap, unusual_modes)
122
123
        commit_obj = self._revision_to_commit(rev, tree_sha)
123
124
        try:
124
125
            foreign_revid, mapping = mapping_registry.parse_revision_id(revid)
154
155
        else:
155
156
            raise AssertionError("unknown entry kind '%s'" % entry.kind)
156
157
 
157
 
    def _get_ie_object_or_sha1(self, entry, inv, unusual_modes):
158
 
        # FIXME: Pass in?
159
 
        invshamap = self._idmap.get_inventory_sha_map(inv.revision_id)
 
158
    def _get_ie_object_or_sha1(self, entry, inv, invshamap, unusual_modes):
160
159
        if entry.kind == "directory":
161
160
            try:
162
161
                return invshamap.lookup_tree(entry.file_id), None
181
180
        else:
182
181
            raise AssertionError("unknown entry kind '%s'" % entry.kind)
183
182
 
184
 
    def _get_ie_sha1(self, entry, inv, unusual_modes):
185
 
        return self._get_ie_object_or_sha1(entry, inv, unusual_modes)[0]
 
183
    def _get_ie_sha1(self, entry, inv, invshamap, unusual_modes):
 
184
        return self._get_ie_object_or_sha1(entry, inv, invshamap, unusual_modes)[0]
186
185
 
187
186
    def _get_blob_for_symlink(self, symlink_target, expected_sha=None):
188
187
        """Return a Git Blob object for symlink.
232
231
        :param fileid: fileid in the tree.
233
232
        :param revision: Revision of the tree.
234
233
        """
 
234
        invshamap = self._idmap.get_inventory_sha_map(inv.revision_id)
235
235
        tree = directory_to_tree(inv[fileid],
236
 
            lambda ie: self._get_ie_sha1(ie, inv, unusual_modes),
 
236
            lambda ie: self._get_ie_sha1(ie, inv, invshamap, unusual_modes),
237
237
            unusual_modes)
238
238
        self._check_expected_sha(expected_sha, tree)
239
239
        return tree