Add pre-commit autoupdate --semver

This chooses the latest version according to semantic versioning.
Prereleases are only chosen if `--semver-prerelease` is also specified.
This commit is contained in:
Jeff Epler 2022-12-09 16:26:55 -06:00
parent cb0bcfd67f
commit 880616df3e
No known key found for this signature in database
GPG key ID: D5BF15AB975AB4DE
5 changed files with 271 additions and 62 deletions

View file

@ -44,7 +44,10 @@ def test_gc(tempdir_factory, store, in_git_dir, cap_out):
# update will clone both the old and new repo, making the old one gc-able
install_hooks(C.CONFIG_FILE, store)
assert not autoupdate(C.CONFIG_FILE, store, freeze=False, tags_only=False)
assert not autoupdate(
C.CONFIG_FILE, store, freeze=False, tags_only=False,
semver=False, semver_stable_only=False,
)
assert _config_count(store) == 1
assert _repo_count(store) == 2