mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
add support for top-level map manifest
This commit is contained in:
parent
9c7ea88ab9
commit
7cad9ec27f
10 changed files with 156 additions and 61 deletions
|
|
@ -77,7 +77,7 @@ class RevInfo(NamedTuple):
|
|||
except InvalidManifestError as e:
|
||||
raise RepositoryCannotBeUpdatedError(f'[{self.repo}] {e}')
|
||||
else:
|
||||
hook_ids = frozenset(hook['id'] for hook in manifest)
|
||||
hook_ids = frozenset(hook['id'] for hook in manifest['hooks'])
|
||||
|
||||
return self._replace(rev=rev, frozen=frozen, hook_ids=hook_ids)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ def _mark_used_repos(
|
|||
return
|
||||
else:
|
||||
unused_repos.discard(key)
|
||||
by_id = {hook['id']: hook for hook in manifest}
|
||||
by_id = manifest['hooks']
|
||||
|
||||
for hook in repo['hooks']:
|
||||
if hook['id'] not in by_id:
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ def try_repo(args: argparse.Namespace) -> int:
|
|||
else:
|
||||
repo_path = store.clone(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]
|
||||
hook_ids = sorted(hook['id'] for hook in manifest['hooks'])
|
||||
hooks = [{'id': hook_id} for hook_id in hook_ids]
|
||||
|
||||
config = {'repos': [{'repo': repo, 'rev': ref, 'hooks': hooks}]}
|
||||
config_s = yaml_dump(config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue