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

@ -199,6 +199,18 @@ def main(argv: Sequence[str] | None = None) -> int:
help="Auto-update pre-commit config to the latest repos' versions.",
)
_add_config_option(autoupdate_parser)
autoupdate_parser.add_argument(
'--semver', action='store_true',
help=(
'Use the highest version according to semantic versoning.'
),
)
autoupdate_parser.add_argument(
'--semver-prerelease', action='store_true',
help=(
'Use pre-release versions according to semver.'
),
)
autoupdate_parser.add_argument(
'--bleeding-edge', action='store_true',
help=(
@ -355,6 +367,8 @@ def main(argv: Sequence[str] | None = None) -> int:
return autoupdate(
args.config, store,
tags_only=not args.bleeding_edge,
semver=args.semver,
semver_stable_only=not args.semver_prerelease,
freeze=args.freeze,
repos=args.repos,
)