/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 mapping.py

Specify inventory and texts to inventory_to_tree_and_blobs rather than full repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
    return blob
153
153
 
154
154
 
155
 
def inventory_to_tree_and_blobs(repo, mapping, revision_id):
 
155
def inventory_to_tree_and_blobs(inventory, texts, mapping):
156
156
    from dulwich.objects import Tree
157
157
    from bzrlib.inventory import InventoryDirectory, InventoryFile
158
158
    import stat
160
160
    cur = ""
161
161
    tree = Tree()
162
162
 
163
 
    inv = repo.get_inventory(revision_id)
164
 
 
165
163
    # stack contains the set of trees that we haven't 
166
164
    # finished constructing
167
 
    for path, entry in inv.iter_entries():
 
165
    for path, entry in inventory.iter_entries():
168
166
        while stack and not path.startswith(cur):
169
167
            tree.serialize()
170
168
            sha = tree.id
181
179
        if type(entry) == InventoryFile:
182
180
            #FIXME: We can make potentially make this Lazy to avoid shaing lots of stuff
183
181
            # and having all these objects in memory at once
184
 
            text = repo.texts.get_record_stream([(entry.file_id, entry.revision)], 'unordered', True).next().get_bytes_as('fulltext')
 
182
            text = texts.get_record_stream([(entry.file_id, entry.revision)], 'unordered', True).next().get_bytes_as('fulltext')
185
183
            blob = text_to_blob(text)
186
184
            sha = blob.id
187
185
            yield sha, blob, path