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.
This commit is contained in:
Daniele Varrazzo 2014-08-22 06:23:54 +01:00
parent c114aff435
commit baf1ad251e
2 changed files with 18 additions and 3 deletions

View File

@ -66,7 +66,9 @@ intersphinx_mapping = {
} }
# Pattern to generate links to the bug tracker # 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 # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

View File

@ -3,7 +3,7 @@
ticket role 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. :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) prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [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: if url_pattern is None:
msg = inliner.reporter.warning( msg = inliner.reporter.warning(
"ticket not configured: please configure ticket_url in conf.py") "ticket not configured: please configure ticket_url in conf.py")
prb = inliner.problematic(rawtext, rawtext, msg) prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [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 url = url_pattern % num
roles.set_classes(options) roles.set_classes(options)
node = nodes.reference(rawtext, 'ticket ' + utils.unescape(text), 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): def setup(app):
app.add_config_value('ticket_url', None, 'env') 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) app.add_role('ticket', ticket_role)