|
a/scripts/refresh-all-repos.py |
|
b/scripts/refresh-all-repos.py |
|
... |
|
... |
10 |
log = logging.getLogger(__name__)
|
10 |
log = logging.getLogger(__name__)
|
11 |
|
11 |
|
12 |
PAGESIZE=1024
|
12 |
PAGESIZE=1024
|
13 |
|
13 |
|
14 |
def main():
|
14 |
def main():
|
15 |
parser = optparse.OptionParser()
|
15 |
parser = optparse.OptionParser(usage="%prog -- [options] [someproject/code [proj/mount ...]]")
|
16 |
parser.add_option(
|
16 |
parser.add_option(
|
17 |
'--clean', action='store_true', dest='clean', default=False,
|
17 |
'--clean', action='store_true', dest='clean', default=False,
|
18 |
help='remove all RepoObjects before refresh')
|
18 |
help='remove all RepoObjects before refresh')
|
19 |
parser.add_option(
|
19 |
parser.add_option(
|
20 |
'--all', action='store_true', dest='all', default=False,
|
20 |
'--all', action='store_true', dest='all', default=False,
|
21 |
help='refresh all commits (not just the ones that are new')
|
21 |
help='refresh all commits (not just the ones that are new')
|
|
|
22 |
parser.add_option(
|
|
|
23 |
'--notify', action='store_true', dest='notify', default=False,
|
|
|
24 |
help='send email notifications of new commits')
|
22 |
options, args = parser.parse_args()
|
25 |
options, args = parser.parse_args()
|
23 |
if args:
|
26 |
if args:
|
24 |
projects = defaultdict(list)
|
27 |
projects = defaultdict(list)
|
25 |
for path in args:
|
28 |
for path in args:
|
26 |
shortname, mount_point = path.rsplit('/', 1)
|
29 |
shortname, mount_point = path.rsplit('/', 1)
|
|
... |
|
... |
53 |
try:
|
56 |
try:
|
54 |
if options.all:
|
57 |
if options.all:
|
55 |
log.info('Refreshing ALL commits in %r', c.app.repo)
|
58 |
log.info('Refreshing ALL commits in %r', c.app.repo)
|
56 |
else:
|
59 |
else:
|
57 |
log.info('Refreshing NEW commits in %r', c.app.repo)
|
60 |
log.info('Refreshing NEW commits in %r', c.app.repo)
|
58 |
c.app.repo.refresh(options.all)
|
61 |
c.app.repo.refresh(options.all, notify=options.notify)
|
59 |
except:
|
62 |
except:
|
60 |
log.exception('Error refreshing %r', c.app.repo)
|
63 |
log.exception('Error refreshing %r', c.app.repo)
|
61 |
ThreadLocalORMSession.flush_all()
|
64 |
ThreadLocalORMSession.flush_all()
|
62 |
ThreadLocalORMSession.close_all()
|
65 |
ThreadLocalORMSession.close_all()
|
63 |
|
66 |
|
|
... |
|
... |
70 |
.limit(PAGESIZE)
|
73 |
.limit(PAGESIZE)
|
71 |
.all())
|
74 |
.all())
|
72 |
if not results: break
|
75 |
if not results: break
|
73 |
yield results
|
76 |
yield results
|
74 |
page += 1
|
77 |
page += 1
|
75 |
|
78 |
|
76 |
|
79 |
|
77 |
if __name__ == '__main__':
|
80 |
if __name__ == '__main__':
|
78 |
main()
|
81 |
main()
|