|
135 | 135 |
|
136 | 136 | prehook = None
|
137 | 137 | posthook = None
|
| 138 | + ignored_repos = [] |
| 139 | + use_proxy = False |
138 | 140 | 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: |
140 | 146 | if not hookdir:
|
141 | 147 | logger.error("Need to have 'hookdir' in the configuration "
|
142 | 148 | "to run hooks")
|
|
146 | 152 | logger.error("Not a directory: {}".format(hookdir))
|
147 | 153 | sys.exit(1)
|
148 | 154 |
|
149 |
| - hooks = project_config['hooks'] |
150 | 155 | for hookname in hooks:
|
151 | 156 | if hookname == "pre":
|
152 | 157 | prehook = hookpath = os.path.join(hookdir, hooks['pre'])
|
|
163 | 168 | logger.error("hook file {} does not exist or not "
|
164 | 169 | "executable".format(hookpath))
|
165 | 170 | sys.exit(1)
|
166 |
| - except KeyError: |
167 |
| - pass |
168 | 171 |
|
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 |
176 | 174 |
|
177 | 175 | # Log messages to dedicated log file if running in batch mode.
|
178 | 176 | if args.batch:
|
|
194 | 192 |
|
195 | 193 | # We want this to be logged to the log file (if any).
|
196 | 194 | 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) |
204 | 199 |
|
205 | 200 | lock = filelock.FileLock(os.path.join(tempfile.gettempdir(),
|
206 | 201 | args.project + "-mirror.lock"))
|
|
219 | 214 | #
|
220 | 215 | for repo_path in get_repos(logger, args.project, messages_file):
|
221 | 216 | 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 | + |
222 | 222 | repo_type = get_repo_type(logger, repo_path, messages_file)
|
223 | 223 | if not repo_type:
|
224 | 224 | logger.error("cannot determine type of {}".
|
|
0 commit comments