mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 16:44:42 +04:00
Add pre-commit try-repo
`try-repo` is useful for: - Trying out a remote hook repository without needing to configure it. - Testing a hook repository while developing it.
This commit is contained in:
parent
e8641ee0a3
commit
2c88791a7f
15 changed files with 254 additions and 110 deletions
|
|
@ -10,6 +10,7 @@ from aspy.yaml import ordered_dump
|
|||
from aspy.yaml import ordered_load
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import git
|
||||
from pre_commit.clientlib import CONFIG_SCHEMA
|
||||
from pre_commit.clientlib import load_manifest
|
||||
from pre_commit.schema import apply_defaults
|
||||
|
|
@ -17,7 +18,6 @@ from pre_commit.schema import validate
|
|||
from pre_commit.util import cmd_output
|
||||
from pre_commit.util import copy_tree_to_path
|
||||
from pre_commit.util import cwd
|
||||
from testing.util import get_head_sha
|
||||
from testing.util import get_resource_path
|
||||
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ def make_config_from_repo(repo_path, sha=None, hooks=None, check=True):
|
|||
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
|
||||
config = OrderedDict((
|
||||
('repo', 'file://{}'.format(repo_path)),
|
||||
('sha', sha or get_head_sha(repo_path)),
|
||||
('sha', sha or git.head_sha(repo_path)),
|
||||
(
|
||||
'hooks',
|
||||
hooks or [OrderedDict((('id', hook['id']),)) for hook in manifest],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue