Skip to content

Commit 825036f

Browse files
author
Vladimir Kotal
committed
make it possible to ignore repositories of a project
1 parent 195bc36 commit 825036f

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

tools/sync/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ projects:
6464
hooks:
6565
pre: userland-pre.ksh
6666
post: userland-post.ksh
67+
opengrok-master:
68+
- ignored_repos:
69+
/opengrok-master/testdata/repositories/rcs_test
6770
```
6871

6972
See https://github.com/OpenGrok/OpenGrok/wiki/Per-project-management

tools/sync/mirror.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,14 @@
135135

136136
prehook = None
137137
posthook = None
138+
ignored_repos = []
139+
use_proxy = False
138140
if project_config:
139-
try:
141+
if project_config.get('ignored_repos'):
142+
ignored_repos = project_config.get('ignored_repos')
143+
144+
hooks = project_config.get('hooks')
145+
if hooks:
140146
if not hookdir:
141147
logger.error("Need to have 'hookdir' in the configuration "
142148
"to run hooks")
@@ -146,7 +152,6 @@
146152
logger.error("Not a directory: {}".format(hookdir))
147153
sys.exit(1)
148154

149-
hooks = project_config['hooks']
150155
for hookname in hooks:
151156
if hookname == "pre":
152157
prehook = hookpath = os.path.join(hookdir, hooks['pre'])
@@ -163,16 +168,9 @@
163168
logger.error("hook file {} does not exist or not "
164169
"executable".format(hookpath))
165170
sys.exit(1)
166-
except KeyError:
167-
pass
168171

169-
use_proxy = False
170-
if project_config:
171-
try:
172-
if project_config['proxy']:
173-
use_proxy = True
174-
except KeyError:
175-
pass
172+
if project_config.get('proxy'):
173+
use_proxy = True
176174

177175
# Log messages to dedicated log file if running in batch mode.
178176
if args.batch:
@@ -194,13 +192,10 @@
194192

195193
# We want this to be logged to the log file (if any).
196194
if project_config:
197-
try:
198-
if project_config['disabled']:
199-
logger.info("Project {} disabled, exiting".
200-
format(args.project))
201-
sys.exit(0)
202-
except KeyError:
203-
pass
195+
if project_config.get('disabled'):
196+
logger.info("Project {} disabled, exiting".
197+
format(args.project))
198+
sys.exit(0)
204199

205200
lock = filelock.FileLock(os.path.join(tempfile.gettempdir(),
206201
args.project + "-mirror.lock"))
@@ -219,6 +214,11 @@
219214
#
220215
for repo_path in get_repos(logger, args.project, messages_file):
221216
logger.debug("Repository path = {}".format(repo_path))
217+
218+
if repo_path in ignored_repos:
219+
logger.debug("repository {} ignored".format(repo_path))
220+
continue
221+
222222
repo_type = get_repo_type(logger, repo_path, messages_file)
223223
if not repo_type:
224224
logger.error("cannot determine type of {}".

0 commit comments

Comments
 (0)