diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index bf58b4b97..d81f3da64 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -8,7 +8,7 @@ name: DVC pre-commit require_serial: true stages: - - commit + - pre-commit verbose: true - args: - git-hook @@ -20,7 +20,7 @@ name: DVC pre-push require_serial: true stages: - - push + - pre-push - always_run: true args: - git-hook @@ -29,7 +29,7 @@ id: dvc-post-checkout language: python language_version: python3 - minimum_pre_commit_version: 2.2.0 + minimum_pre_commit_version: 3.2.0 name: DVC post-checkout require_serial: true stages: diff --git a/dvc/repo/install.py b/dvc/repo/install.py index 149e1ae95..ddf274d3a 100644 --- a/dvc/repo/install.py +++ b/dvc/repo/install.py @@ -1,5 +1,6 @@ from typing import TYPE_CHECKING +from dvc import version_tuple from dvc.exceptions import DvcException if TYPE_CHECKING: @@ -16,19 +17,19 @@ def pre_commit_install(scm: "Git") -> None: with modify_yaml(config_path) as config: entry = { "repo": "https://github.com/iterative/dvc", - "rev": "main", + "rev": ".".join(map(str, version_tuple[:3])), "hooks": [ { "id": "dvc-pre-commit", "additional_dependencies": [".[all]"], "language_version": "python3", - "stages": ["commit"], + "stages": ["pre-commit"], }, { "id": "dvc-pre-push", "additional_dependencies": [".[all]"], "language_version": "python3", - "stages": ["push"], + "stages": ["pre-push"], }, { "id": "dvc-post-checkout",