|
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(usage="%prog -- [options] [someproject/code [proj/mount ...]]")
|
15 |
parser = optparse.OptionParser(usage="""%prog -- [options] [/p/ someproject/optional-subproj mount-point]\n\n
|
|
|
16 |
Specify a neighborhood url-prefix, project shortname, and mountpoint to run for just one repo. Omit that
|
|
|
17 |
to run for all repos.
|
|
|
18 |
""")
|
16 |
parser.add_option(
|
19 |
parser.add_option(
|
17 |
'--clean', action='store_true', dest='clean', default=False,
|
20 |
'--clean', action='store_true', dest='clean', default=False,
|
18 |
help='remove all RepoObjects before refresh')
|
21 |
help='remove all RepoObjects before refresh')
|
19 |
parser.add_option(
|
22 |
parser.add_option(
|
20 |
'--all', action='store_true', dest='all', default=False,
|
23 |
'--all', action='store_true', dest='all', default=False,
|
|
... |
|
... |
22 |
parser.add_option(
|
25 |
parser.add_option(
|
23 |
'--notify', action='store_true', dest='notify', default=False,
|
26 |
'--notify', action='store_true', dest='notify', default=False,
|
24 |
help='send email notifications of new commits')
|
27 |
help='send email notifications of new commits')
|
25 |
options, args = parser.parse_args()
|
28 |
options, args = parser.parse_args()
|
26 |
if args:
|
29 |
if args:
|
27 |
projects = defaultdict(list)
|
30 |
nbhd = M.Neighborhood.query.get(url_prefix=args[0])
|
28 |
for path in args:
|
31 |
shortname = args[1]
|
29 |
shortname, mount_point = path.rsplit('/', 1)
|
32 |
mount_point = args[2]
|
|
|
33 |
q_project = {'shortname': shortname, 'neighborhood_id': nbhd._id}
|
30 |
projects[shortname].append(mount_point)
|
34 |
projects = {shortname:[mount_point]}
|
31 |
q_project = dict(shortname={'$in': projects.keys()})
|
|
|
32 |
else:
|
35 |
else:
|
33 |
projects = {}
|
36 |
projects = {}
|
34 |
q_project = {}
|
37 |
q_project = {}
|
35 |
log.info('Refreshing repositories')
|
38 |
log.info('Refreshing repositories')
|
36 |
if options.clean:
|
39 |
if options.clean:
|