Parent: [88a95c] (diff)

Child: [012a4b] (diff)

Download this file

refresh-all-repos.py    35 lines (29 with data), 997 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import logging
from pylons import c
from allura import model as M
from forgegit import model as GM
from forgehg import model as HM
from forgesvn import model as SM
log = logging.getLogger(__name__)
def main():
projects = M.Project.query.find().all()
log.info('Refreshing repositories')
for p in projects:
if p.parent_id: continue
c.project = p
for cls in (GM.Repository, HM.Repository, SM.Repository):
for repo in cls.query.find():
try:
c.app = repo.app
except:
log.exception('Error looking up app for %r', repo)
try:
repo.refresh()
except:
log.exception('Error refreshing %r', repo)
try:
repo._impl._setup_receive_hook()
except:
log.exception('Error setting up receive hook for %r', repo)
if __name__ == '__main__':
main()