Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add releases_future_release_uri config #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Changelog
=========

* :feature:`-` Add a configuration to change the link for unreleased changes
* :bug:`53` Tweak newly-updated models so bugfix items prior to an initial
release are considered 'major bugs' so they get rolled into that initial
release (instead of causing a ``ValueError``).
Expand Down
9 changes: 8 additions & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ Specifically:
(If only one is configured, the other link type will continue using
``releases_github_path``.)

* If your unreleased changes live in a different location than your existing
releases, set ``releases_future_release_uri`` separately from ``releases_release_uri``.
This option *does not* accept a ``%s`` substitution.
This setting can also be used to change the branch linked to by unreleased changes.
(E.g. ``releases_release_uri = "https://github.com/fabric/fabric/releases/tag/%s"`` and
``releases_future_release_uri = "https://github.com/fabric/fabric/tree/develop"``)

* See `Fabric's docs/conf.py
<https://github.com/fabric/fabric/blob/4afd33e971f1c6831cc33fd3228013f7484fbe35/docs/conf.py#L31>`_
for an example.
Expand Down Expand Up @@ -60,7 +67,7 @@ Specifically:
will not be given a hyperlink.

* Issue roles are of the form ``:type:`number[ keyword]```. Specifically:

* ``number`` is used to generate the link to the actual issue in your issue
tracker (going by the ``releases_issue_uri`` option). It's used for both
the link target & (part of) the link text.
Expand Down
10 changes: 8 additions & 2 deletions releases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def release_nodes(text, slug, date, config):
# title and give it these HTML attributes during render time) so...fuckit.
# We were already doing fully raw elements elsewhere anyway. And who cares
# about a PDF of a changelog? :x
if config.releases_release_uri:
if slug == 'master' and config.releases_future_release_uri:
uri = config.releases_future_release_uri
elif config.releases_release_uri:
# TODO: % vs .format()
uri = config.releases_release_uri % slug
elif config.releases_github_path:
Expand Down Expand Up @@ -180,7 +182,7 @@ def append_unreleased_entries(app, lines, releases):
# TODO: should link to master for newest family and...what
# exactly, for the others? Expectation isn't necessarily to
# have a branch per family? Or is there? Maybe there must be..
'master',
'master',
None,
app.config
)]
Expand Down Expand Up @@ -542,6 +544,10 @@ def setup(app):
# E.g. 'https://github.com/fabric/fabric/tree/'
app.add_config_value(name='releases_release_uri', default=None,
rebuild='html')
# Future Release-tag base URI setting: releases_future_release_uri
# E.g. 'https://github.com/fabric/fabric/tree/develop/'
app.add_config_value(name='releases_future_release_uri', default=None,
rebuild='html')
# Convenience Github version of above
app.add_config_value(name='releases_github_path', default=None,
rebuild='html')
Expand Down
1 change: 1 addition & 0 deletions tests/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def make_app(**kwargs):
config = {
'releases_release_uri': 'foo_%s',
'releases_issue_uri': 'bar_%s',
'releases_future_release_uri': 'baz',
'releases_debug': False,
}
# Allow tinkering with document filename
Expand Down