From baf1ad251e2b41673eb356d210bf742a5bf311ac Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 22 Aug 2014 06:23:54 +0100 Subject: [PATCH] Point tickets to GitHub instead of Lighthouse Keep into account the numbers reshuffling: Lighthouse bugs with a number matching a GitHub merge request are shifted ahead. --- doc/src/conf.py | 4 +++- doc/src/tools/lib/ticket_role.py | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/src/conf.py b/doc/src/conf.py index 5937a7b4..6c26fcbe 100644 --- a/doc/src/conf.py +++ b/doc/src/conf.py @@ -66,7 +66,9 @@ intersphinx_mapping = { } # Pattern to generate links to the bug tracker -ticket_url = 'http://psycopg.lighthouseapp.com/projects/62710/tickets/%s' +ticket_url = 'https://github.com/psycopg/psycopg2/issues/%s' +ticket_remap_until = 20 +ticket_remap_offset = 230 # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/src/tools/lib/ticket_role.py b/doc/src/tools/lib/ticket_role.py index f8ceea17..28900661 100644 --- a/doc/src/tools/lib/ticket_role.py +++ b/doc/src/tools/lib/ticket_role.py @@ -3,7 +3,7 @@ ticket role ~~~~~~~~~~~ - An interpreted text role to link docs to lighthouse issues. + An interpreted text role to link docs to tickets issues. :copyright: Copyright 2013 by Daniele Varrazzo. """ @@ -20,13 +20,24 @@ def ticket_role(name, rawtext, text, lineno, inliner, options={}, content=[]): prb = inliner.problematic(rawtext, rawtext, msg) return [prb], [msg] - url_pattern = inliner.document.settings.env.app.config.ticket_url + cfg = inliner.document.settings.env.app.config + url_pattern = cfg.ticket_url if url_pattern is None: msg = inliner.reporter.warning( "ticket not configured: please configure ticket_url in conf.py") prb = inliner.problematic(rawtext, rawtext, msg) return [prb], [msg] + # Push numbers of the oldel tickets ahead. + # We moved the tickets from a different tracker to GitHub and the + # latter already had a few ticket numbers taken (as merge + # requests). + remap_until = cfg.ticket_remap_until + remap_offset = cfg.ticket_remap_offset + if remap_until and remap_offset: + if num <= remap_until: + num += remap_offset + url = url_pattern % num roles.set_classes(options) node = nodes.reference(rawtext, 'ticket ' + utils.unescape(text), @@ -35,5 +46,7 @@ def ticket_role(name, rawtext, text, lineno, inliner, options={}, content=[]): def setup(app): app.add_config_value('ticket_url', None, 'env') + app.add_config_value('ticket_remap_until', None, 'env') + app.add_config_value('ticket_remap_offset', None, 'env') app.add_role('ticket', ticket_role)