/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

Add asserts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
    def revision_tree(self, revid):
75
75
        try:
76
 
            return self._cache[revid]
 
76
            tree = self._cache[revid]
77
77
        except KeyError:
78
78
            tree = self.repository.revision_tree(revid)
79
79
            self.add(tree)
80
 
            return tree
 
80
        assert tree.get_revision_id() == tree.inventory.revision_id
 
81
        return tree
81
82
 
82
83
    def iter_revision_trees(self, revids):
83
 
        trees = dict([(k, self._cache.get(k)) for k in revids]) 
84
 
        for tree in self.repository.revision_trees(
85
 
                [r for r, v in trees.iteritems() if v is None]):
 
84
        trees = {}
 
85
        todo = []
 
86
        for revid in revids:
 
87
            try:
 
88
                tree = self._cache[revid]
 
89
            except KeyError:
 
90
                todo.append(revid)
 
91
            else:
 
92
                assert tree.get_revision_id() == revid
 
93
                assert tree.inventory.revision_id == revid
 
94
                trees[revid] = tree
 
95
        for tree in self.repository.revision_trees(todo):
86
96
            trees[tree.get_revision_id()] = tree
87
97
            self.add(tree)
88
98
        return (trees[r] for r in revids)
225
235
    for path in unusual_modes:
226
236
        parent_path = posixpath.dirname(path)
227
237
        new_trees[parent_path] = tree.path2id(parent_path)
228
 
    
 
238
 
229
239
    trees = {}
230
240
    while new_trees:
231
241
        items = new_trees.items()