Beispiel #1
0
 def refresh_tree_info(self, tree, seen, lazy=True):
     from allura.model.repository 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
Beispiel #2
0
 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