Set __commit__ to an empty string for non-dev releases#1174
Conversation
|
/format |
doc/conf.py
Outdated
| f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>' | ||
| ) | ||
| else: | ||
| commit_link = "" |
There was a problem hiding this comment.
Since we have this if-else block, could we be smart and point to the tag on GitHub?
There was a problem hiding this comment.
We'll need to detect whether the commit string is a hash like a1b2c4d4 or a version tag like v0.X.Y, but the idea is to have something like so (note, don't commit yet as it won't work):
| commit_link = "" | |
| commit_link = f'<a href="{repository_url}/tree/{ __commit__ }">{ __commit__}</a>' |
which would e.g. point to https://github.com/GenericMappingTools/pygmt/tree/v0.3.1
There was a problem hiding this comment.
I was thinking about it too. It's OK to point to the specific tag, but the text would be "Revision v0.3.1", not "Release v0.3.1".
There was a problem hiding this comment.
"Revision v0.3.1" doesn't sound too bad actually (though it's not perfect either).
There was a problem hiding this comment.
There was a problem hiding this comment.
Does this need to be backported to the gh-pages branch?
There was a problem hiding this comment.
Perhaps do the backport together with #1151, as mentioned in #1150 (comment).
…gTools#1174) * Set __commit__ to an empty string for non-dev releases * Link to tags for non-dev releases Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com>

Description of proposed changes
For non-dev versions,
__version__is a string likev0.3.1, without commit hashes. In this case, we should set__commit__to"".When
__commit__is empty, the "Revision xxx" in the documentation footer won't show, so this PR also fixes #1171.Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version