mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 10:01:46 +04:00
Added requested changes
This commit is contained in:
parent
bf8c8521cd
commit
e339de22d7
1 changed files with 7 additions and 6 deletions
|
|
@ -11,10 +11,10 @@ from cfgv import remove_defaults
|
||||||
import pre_commit.constants as C
|
import pre_commit.constants as C
|
||||||
from pre_commit import output
|
from pre_commit import output
|
||||||
from pre_commit.clientlib import CONFIG_SCHEMA
|
from pre_commit.clientlib import CONFIG_SCHEMA
|
||||||
|
from pre_commit.clientlib import InvalidManifestError
|
||||||
from pre_commit.clientlib import is_local_repo
|
from pre_commit.clientlib import is_local_repo
|
||||||
from pre_commit.clientlib import is_meta_repo
|
from pre_commit.clientlib import is_meta_repo
|
||||||
from pre_commit.clientlib import load_config
|
from pre_commit.clientlib import load_config
|
||||||
from pre_commit.clientlib import InvalidManifestError
|
|
||||||
from pre_commit.commands.migrate_config import migrate_config
|
from pre_commit.commands.migrate_config import migrate_config
|
||||||
from pre_commit.repository import Repository
|
from pre_commit.repository import Repository
|
||||||
from pre_commit.util import CalledProcessError
|
from pre_commit.util import CalledProcessError
|
||||||
|
|
@ -54,14 +54,15 @@ def _update_repo(repo_config, store, tags_only):
|
||||||
# Construct a new config with the head rev
|
# Construct a new config with the head rev
|
||||||
new_config = OrderedDict(repo_config)
|
new_config = OrderedDict(repo_config)
|
||||||
new_config['rev'] = rev
|
new_config['rev'] = rev
|
||||||
new_repo = Repository.create(new_config, store)
|
|
||||||
|
try:
|
||||||
|
new_hooks = Repository.create(new_config, store).manifest_hooks
|
||||||
|
except InvalidManifestError as e:
|
||||||
|
raise RepositoryCannotBeUpdatedError(e.args[0])
|
||||||
|
|
||||||
# See if any of our hooks were deleted with the new commits
|
# See if any of our hooks were deleted with the new commits
|
||||||
hooks = {hook['id'] for hook in repo_config['hooks']}
|
hooks = {hook['id'] for hook in repo_config['hooks']}
|
||||||
try:
|
hooks_missing = hooks - set(new_hooks)
|
||||||
hooks_missing = hooks - (hooks & set(new_repo.manifest_hooks))
|
|
||||||
except InvalidManifestError as e:
|
|
||||||
raise RepositoryCannotBeUpdatedError(e.args[0])
|
|
||||||
if hooks_missing:
|
if hooks_missing:
|
||||||
raise RepositoryCannotBeUpdatedError(
|
raise RepositoryCannotBeUpdatedError(
|
||||||
'Cannot update because the tip of master is missing these hooks:\n'
|
'Cannot update because the tip of master is missing these hooks:\n'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue