def refresh_tree_info(self, tree, seen, lazy=True): from allura.model.repo import TreeDoc if lazy and tree.binsha in seen: return seen.add(tree.binsha) doc = TreeDoc(dict( _id=tree.hexsha, tree_ids=[], blob_ids=[], other_ids=[])) for o in tree: if o.type == 'submodule': continue obj = Object( name=h.really_unicode(o.name), id=o.hexsha) if o.type == 'tree': self.refresh_tree_info(o, seen, lazy) doc.tree_ids.append(obj) elif o.type == 'blob': doc.blob_ids.append(obj) else: obj.type = o.type doc.other_ids.append(obj) doc.m.save(safe=False) return doc
def refresh_tree_info(self, tree, seen, lazy=True): from allura.model.repo import TreeDoc if lazy and tree.hex() in seen: return seen.add(tree.hex()) doc = TreeDoc( dict(_id=tree.hex(), tree_ids=[], blob_ids=[], other_ids=[])) for name, t in tree.trees.iteritems(): self.refresh_tree_info(t, seen, lazy) doc.tree_ids.append(dict(name=h.really_unicode(name), id=t.hex())) for name, oid in tree.blobs.iteritems(): doc.blob_ids.append(dict(name=h.really_unicode(name), id=oid)) doc.m.save(safe=False) return doc