Download this file

force-refresh-repos.py    34 lines (28 with data), 956 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
import sys
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():
shortnames = sys.argv[1:]
for sn in shortnames:
c.project = M.Project.query.get(shortname=sn)
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()