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

Avoid use of get_ie_object_or_sha1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
        rev = self.source.get_revision(revid)
103
103
        invshamap = self._object_store._idmap.get_inventory_sha_map(revid)
104
104
        unusual_modes = extract_unusual_modes(rev)
105
 
        todo = [inv.root]
 
105
        parent_invshamaps = [self._object_store._idmap.get_inventory_sha_map(r) for r in rev.parent_ids]
106
106
        tree_sha = None
107
 
        while todo:
108
 
            ie = todo.pop()
109
 
            (sha, object) = self._object_store._get_ie_object_or_sha1(ie, inv, invshamap, unusual_modes)
 
107
        for path, obj in self._object_store._inventory_to_objects(inv, 
 
108
                list(self.source.iter_inventories(rev.parent_ids)),
 
109
                parent_invshamaps,
 
110
                unusual_modes):
 
111
            ie = inv[inv.path2id(path)]
 
112
            self.queue(obj.id, obj, path, ie, inv, unusual_modes)
110
113
            if ie.parent_id is None:
111
 
                tree_sha = sha
112
 
            if not self.need_sha(sha):
113
 
                continue
114
 
            self.queue(sha, object, inv.id2path(ie.file_id), ie, inv, unusual_modes)
115
 
            if ie.kind == "directory":
116
 
                todo.extend(ie.children.values())
117
 
        assert tree_sha is not None
 
114
                tree_sha = obj.id
 
115
        if tree_sha is None:
 
116
            if not rev.parent_ids:
 
117
                from dulwich.objects import Tree
 
118
                tree_sha = Tree().id
 
119
            else:
 
120
                tree_sha = parent_invshamaps[0][inv.root.file_id]
118
121
        commit = self._object_store._get_commit(rev, tree_sha)
119
122
        self.queue(commit.id, commit, None, None)
120
123
        return commit.id