From 1c97d3f5fde3804ded59f65ef8f12ea429638c4d Mon Sep 17 00:00:00 2001 From: Milos Pejanovic Date: Wed, 31 Oct 2018 17:39:47 +0100 Subject: [PATCH] Added a try except block which reraises InvalidManifestError as RepositoryCannotBeUpdatedError --- pre_commit/commands/autoupdate.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py index 8f3714c4..d08ea411 100644 --- a/pre_commit/commands/autoupdate.py +++ b/pre_commit/commands/autoupdate.py @@ -14,6 +14,7 @@ from pre_commit.clientlib import CONFIG_SCHEMA from pre_commit.clientlib import is_local_repo from pre_commit.clientlib import is_meta_repo 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.repository import Repository from pre_commit.util import CalledProcessError @@ -57,7 +58,10 @@ def _update_repo(repo_config, store, tags_only): # See if any of our hooks were deleted with the new commits hooks = {hook['id'] for hook in repo_config['hooks']} - hooks_missing = hooks - (hooks & set(new_repo.manifest_hooks)) + try: + hooks_missing = hooks - (hooks & set(new_repo.manifest_hooks)) + except InvalidManifestError as e: + raise RepositoryCannotBeUpdatedError(e.args[0]) if hooks_missing: raise RepositoryCannotBeUpdatedError( 'Cannot update because the tip of master is missing these hooks:\n'