mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Remove stateful Runner
This commit is contained in:
parent
1d40cc2104
commit
fe409f1a43
17 changed files with 209 additions and 315 deletions
|
|
@ -45,15 +45,15 @@ def _migrate_sha_to_rev(contents):
|
|||
return reg.sub(r'\1rev:', contents)
|
||||
|
||||
|
||||
def migrate_config(runner, quiet=False):
|
||||
with io.open(runner.config_file_path) as f:
|
||||
def migrate_config(config_file, quiet=False):
|
||||
with io.open(config_file) as f:
|
||||
orig_contents = contents = f.read()
|
||||
|
||||
contents = _migrate_map(contents)
|
||||
contents = _migrate_sha_to_rev(contents)
|
||||
|
||||
if contents != orig_contents:
|
||||
with io.open(runner.config_file_path, 'w') as f:
|
||||
with io.open(config_file, 'w') as f:
|
||||
f.write(contents)
|
||||
|
||||
print('Configuration has been migrated.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue