mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 16:44:42 +04:00
Remove Manifest, no longer a useful abstraction
This commit is contained in:
parent
71822279ee
commit
84b1ba520d
6 changed files with 38 additions and 90 deletions
|
|
@ -57,7 +57,7 @@ def _update_repo(repo_config, runner, tags_only):
|
|||
|
||||
# See if any of our hooks were deleted with the new commits
|
||||
hooks = {hook['id'] for hook in repo.repo_config['hooks']}
|
||||
hooks_missing = hooks - (hooks & set(new_repo.manifest.hooks))
|
||||
hooks_missing = hooks - (hooks & set(new_repo.manifest_hooks))
|
||||
if hooks_missing:
|
||||
raise RepositoryCannotBeUpdatedError(
|
||||
'Cannot update because the tip of master is missing these hooks:\n'
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ from aspy.yaml import ordered_dump
|
|||
import pre_commit.constants as C
|
||||
from pre_commit import git
|
||||
from pre_commit import output
|
||||
from pre_commit.clientlib import load_manifest
|
||||
from pre_commit.commands.run import run
|
||||
from pre_commit.manifest import Manifest
|
||||
from pre_commit.runner import Runner
|
||||
from pre_commit.store import Store
|
||||
from pre_commit.util import tmpdir
|
||||
|
|
@ -23,8 +23,10 @@ def try_repo(args):
|
|||
if args.hook:
|
||||
hooks = [{'id': args.hook}]
|
||||
else:
|
||||
manifest = Manifest(Store(tempdir).clone(args.repo, ref))
|
||||
hooks = [{'id': hook_id} for hook_id in sorted(manifest.hooks)]
|
||||
repo_path = Store(tempdir).clone(args.repo, ref)
|
||||
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
|
||||
manifest = sorted(manifest, key=lambda hook: hook['id'])
|
||||
hooks = [{'id': hook['id']} for hook in manifest]
|
||||
|
||||
items = (('repo', args.repo), ('sha', ref), ('hooks', hooks))
|
||||
config = {'repos': [collections.OrderedDict(items)]}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue