Implements two new command line parameter --pre-commit-hook, --post-commit-hook and their config counterparts pre_commit_hook, post_commit_hook.
Paths must bei either absolute or relative to the working directory.
If a hook exits with a return_code != 0 bumpver will stop any further execution
Two environment variables are set for the scripts: BUMPVER_OLD_VERSION, BUMPVER_NEW_VERSION
Any output (stdout, stderr) will be piped to the bumpver log
Example output:
$ bumpver update --post-commit-hook changelog.sh
INFO - fetching tags from remote (to turn off use: -n / --no-fetch)
INFO - Old Version: 2023.1001-alpha
INFO - New Version: 2023.1002-alpha
INFO - git commit --message 'bump version 2023.1001-alpha -> 2023.1002-alpha'
INFO - Run post-commit hook: changelog.sh
INFO - Adding new item in CHANGES.md
INFO - Commiting CHANGES.md
INFO - git tag --annotate 2023.1002-alpha --message '2023.1002-alpha'
$bumpver update --post-commit-hook changelog.sh
INFO - fetching tags from remote (to turn off use: -n / --no-fetch)
INFO - Latest version from VCS tag: 2023.1002-alpha
INFO - Working dir version : 2023.1002-alpha
INFO - Old Version: 2023.1002-alpha
INFO - New Version: 2023.1003-alpha
INFO - git commit --message 'bump version 2023.1002-alpha -> 2023.1003-alpha'
INFO - Run post-commit hook: changelog.sh
ERROR - Environment variable FOOBAR is missing
ERROR - Script exited with an error. Stopping
Closes #178
Implements two new command line parameter
--pre-commit-hook
,--post-commit-hook
and their config counterpartspre_commit_hook
,post_commit_hook
.return_code != 0
bumpver will stop any further executionBUMPVER_OLD_VERSION
,BUMPVER_NEW_VERSION
stdout
,stderr
) will be piped to the bumpver logExample output:
Checklist