From 82e2446eb48b11e36cde6d5369c5f8658ca5cdbb Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Sun, 17 Nov 2024 21:37:11 -0500 Subject: [PATCH] Update `pre-commit` to use pinned version of `dvc` and correct stage names (#10621) Co-authored-by: skshetry <18718008+skshetry@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-hooks.yaml | 6 +++--- dvc/repo/install.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index bf58b4b97e..d81f3da64d 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 149e1ae956..ddf274d3ad 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",