Skip to content

Commit

Permalink
contributing: Add suggest message to version script (#2965)
Browse files Browse the repository at this point in the history
The helper script for updates of versions suggests a commit message right after the update, but when additional changes need to be done, the message from the script can be lost. This adds a subcommand which can generate the message anytime. The message only makes sense when doing the version update, but the script does not check that. It also does not check (does not know) if the RC was just released. We use different commit message after that, but in that case, the commit happens right after the change from RC to dev, so there is no need to use this subcommand.
  • Loading branch information
wenzeslaus authored May 22, 2023
1 parent 6048bac commit 19266d2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions utils/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,28 @@ def status(args):
status_as_yaml(version_info=version_info, today=today, version=version, tag=tag)


def suggest_message(args):
"""Print suggestion for a commit message
Assumes that the version file was changed, but not commited yet,
but it does not check that assumption.
This shows a wrong commit message if going back from RCs,
but it is not likely this is needed because the suggestion
will be part of the message for the switch and there is
no other work to do afterwards except for the commit
(unlike updating the version number).
"""
version_info = read_version_file()
if not version_info.micro.endswith("dev"):
tag = construct_version(version_info)
action = "GRASS GIS"
else:
tag = None
action = "Start"
suggest_commit_from_version_file(action, tag=tag)


def main():
"""Translate sub-commands to function calls"""
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -285,6 +307,11 @@ def main():
)
subparser.set_defaults(func=status)

subparser = subparsers.add_parser(
"suggest", help="suggest a commit message for new version"
)
subparser.set_defaults(func=suggest_message)

args = parser.parse_args()
args.func(args)

Expand Down

0 comments on commit 19266d2

Please sign in to comment.