Add repo option to autoupdate

This commit is contained in:
Kevin Hock 2017-11-06 17:13:47 -08:00 committed by Kevin Hock
parent 0ec3b5556f
commit 4d0c400066
3 changed files with 38 additions and 3 deletions

View file

@ -106,7 +106,7 @@ def _write_new_config_file(path, output):
f.write(to_write)
def autoupdate(runner, tags_only):
def autoupdate(runner, tags_only, repo=None):
"""Auto-update the pre-commit config to the latest versions of repos."""
migrate_config(runner, quiet=True)
retv = 0
@ -116,6 +116,10 @@ def autoupdate(runner, tags_only):
input_config = load_config(runner.config_file_path)
for repo_config in input_config['repos']:
# Skip any repo_configs that aren't the specified repo
if repo and repo != repo_config['repo']:
continue
if is_local_repo(repo_config) or is_meta_repo(repo_config):
output_repos.append(repo_config)
continue