def autoupdate(config_file, store, tags_only, repos=()):
migrate_config(config_file, quiet=True)<EOL>retv = <NUM_LIT:0><EOL>output_repos = []<EOL>changed = False<EOL>input_config = load_config(config_file)<EOL>for repo_config in input_config['<STR_LIT>']:<EOL><INDENT>if (<EOL>repo_config['<STR_LIT>'] in {LOCAL, META} or<EOL>repos and repo_config['<STR_LIT>'] not in repos<EOL>):<EOL><INDENT>output_repos.append(repo_config)<EOL>continue<EOL><DEDENT>output.write('<STR_LIT>'.format(repo_config['<STR_LIT>']))<EOL>try:<EOL><INDENT>new_repo_config = _update_repo(repo_config, store, tags_only)<EOL><DEDENT>except RepositoryCannotBeUpdatedError as error:<EOL><INDENT>output.write_line(error.args[<NUM_LIT:0>])<EOL>output_repos.append(repo_config)<EOL>retv = <NUM_LIT:1><EOL>continue<EOL><DEDENT>if new_repo_config['<STR_LIT>'] != repo_config['<STR_LIT>']:<EOL><INDENT>changed = True<EOL>output.write_line(<EOL>'<STR_LIT>'.format(<EOL>repo_config['<STR_LIT>'], new_repo_config['<STR_LIT>'],<EOL>),<EOL>)<EOL>output_repos.append(new_repo_config)<EOL><DEDENT>else:<EOL><INDENT>output.write_line('<STR_LIT>')<EOL>output_repos.append(repo_config)<EOL><DEDENT><DEDENT>if changed:<EOL><INDENT>output_config = input_config.copy()<EOL>output_config['<STR_LIT>'] = output_repos<EOL>_write_new_config_file(config_file, output_config)<EOL><DEDENT>return retv<EOL>
Auto-update the pre-commit config to the latest versions of repos.