From 1f69d815b395ad773164fc5a8b37298fcbfd4b52 Mon Sep 17 00:00:00 2001 From: Scott Colby Date: Tue, 10 May 2016 02:40:03 -0700 Subject: [PATCH 1/3] Add `releases_future_release_uri` config for future releases that don't have the same link as already existing releases. (Git tags vs. a current development branch, for example) --- releases/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/releases/__init__.py b/releases/__init__.py index a8e46f1..fd27ad8 100644 --- a/releases/__init__.py +++ b/releases/__init__.py @@ -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: @@ -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 )] @@ -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') From e7fc98cd54440da0d10b8666cd52291e9c433447 Mon Sep 17 00:00:00 2001 From: Scott Colby Date: Tue, 10 May 2016 02:51:26 -0700 Subject: [PATCH 2/3] Document my new option. --- docs/changelog.rst | 1 + docs/usage.rst | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a116e2b..ea282f2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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``). diff --git a/docs/usage.rst b/docs/usage.rst index ba36323..ef740f0 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -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 `_ for an example. @@ -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. From f4f9371c6d0c5982d61355bae96b5d6bb0e6f01e Mon Sep 17 00:00:00 2001 From: Scott Colby Date: Tue, 10 May 2016 03:33:27 -0700 Subject: [PATCH 3/3] Add new option to default config in tests/_util.py --- tests/_util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/_util.py b/tests/_util.py index 5787727..267546c 100644 --- a/tests/_util.py +++ b/tests/_util.py @@ -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