mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Set up logging handler in autoupdate
This commit is contained in:
parent
da7e85c851
commit
9c64ce2caf
1 changed files with 9 additions and 0 deletions
|
|
@ -2,11 +2,13 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
|
|
||||||
from aspy.yaml import ordered_dump
|
from aspy.yaml import ordered_dump
|
||||||
from aspy.yaml import ordered_load
|
from aspy.yaml import ordered_load
|
||||||
|
|
||||||
import pre_commit.constants as C
|
import pre_commit.constants as C
|
||||||
|
from pre_commit.logging_handler import LoggingHandler
|
||||||
from pre_commit.clientlib.validate_config import CONFIG_JSON_SCHEMA
|
from pre_commit.clientlib.validate_config import CONFIG_JSON_SCHEMA
|
||||||
from pre_commit.clientlib.validate_config import is_local_hooks
|
from pre_commit.clientlib.validate_config import is_local_hooks
|
||||||
from pre_commit.clientlib.validate_config import load_config
|
from pre_commit.clientlib.validate_config import load_config
|
||||||
|
|
@ -17,6 +19,9 @@ from pre_commit.util import cmd_output
|
||||||
from pre_commit.util import cwd
|
from pre_commit.util import cwd
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger('pre_commit')
|
||||||
|
|
||||||
|
|
||||||
class RepositoryCannotBeUpdatedError(RuntimeError):
|
class RepositoryCannotBeUpdatedError(RuntimeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -58,6 +63,10 @@ def _update_repository(repo_config, runner):
|
||||||
|
|
||||||
def autoupdate(runner):
|
def autoupdate(runner):
|
||||||
"""Auto-update the pre-commit config to the latest versions of repos."""
|
"""Auto-update the pre-commit config to the latest versions of repos."""
|
||||||
|
# Set up our logging handler
|
||||||
|
logger.addHandler(LoggingHandler(False))
|
||||||
|
logger.setLevel(logging.WARNING)
|
||||||
|
|
||||||
retv = 0
|
retv = 0
|
||||||
output_configs = []
|
output_configs = []
|
||||||
changed = False
|
changed = False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue