A framework for managing and maintaining multi-language pre-commit hooks.
Find a file
Michael Bolin 40c83283d6 [rfc] Support Sapling (alternative SCM) when using precommit
When using [Sapling SCM](https://sapling-scm.com/) with a Git
repository, precommit expectedly fails today because it shells
out to `git` to get the list of modified files in the working
copy. In a Sapling clone of a Git repository, these calls will
fail.

While most of the logic in precommit that deals with talking
to Git today is encapsulated in `git.py`, calls to `git` are
sprinkled throughout the project and are called directly. In
order to support alternative SCMs, such as Sapling, ideally
there would be a more generic "SCM" interface that business
logic would call into with both Git and Sapling implementations.

Though this PR does not attempt to introduce such an interface.
Instead, it is just a basic PoC to provide evidence that
something like this could be made to work. For the moment, it
takes a shortcut and simply sprinkles "if Sapling" checks
in `git.py` in enough places that I could get precommit to
run in a Sapling working copy in the simple case where I had
only one file modified locally.

My higher-level question is whether the precommit project
would be open to accepting changes to support Sapling,
either via the introduction of an SCM-agnostic interface or
some other means.
2024-03-01 15:52:20 -08:00
.github Address deprecation warning in shutil.rmtree(onerror=...) 2023-12-09 14:51:01 -05:00
pre_commit [rfc] Support Sapling (alternative SCM) when using precommit 2024-03-01 15:52:20 -08:00
testing python3.9+ 2023-10-28 14:20:37 -04:00
tests fix building golang hooks during commit --all 2024-02-18 13:03:44 -05:00
.gitignore remove unneeded gitignore lines 2022-03-13 19:55:30 -04:00
.pre-commit-config.yaml [pre-commit.ci] pre-commit autoupdate 2024-02-20 00:02:29 +00:00
.pre-commit-hooks.yaml deprecate pre-commit-validate-{config,manifest} 2022-04-24 19:08:47 -04:00
CHANGELOG.md v3.6.2 2024-02-18 13:19:11 -05:00
CONTRIBUTING.md fix typo in CONTRIBUTING.md 2023-08-14 11:00:17 +01:00
LICENSE MIT 2014-06-05 08:57:40 -07:00
README.md azure pipelines -> github actions 2022-12-29 22:18:31 -05:00
requirements-dev.txt always use #!/bin/sh on windows 2022-01-05 13:22:49 -05:00
setup.cfg v3.6.2 2024-02-18 13:19:11 -05:00
setup.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
tox.ini show 20 slowest durations in CI 2023-03-09 11:00:31 -05:00

build status pre-commit.ci status

pre-commit

A framework for managing and maintaining multi-language pre-commit hooks.

For more information see: https://pre-commit.com/