From baf1ad251e2b41673eb356d210bf742a5bf311ac Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 22 Aug 2014 06:23:54 +0100 Subject: [PATCH 1/3] 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) From 2231578922b0df6f21cd72cbfac7d92aa07a4002 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 22 Aug 2014 06:54:59 +0100 Subject: [PATCH 2/3] Added plural version of the tickets role --- NEWS | 4 +-- doc/src/tools/lib/ticket_role.py | 55 ++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/NEWS b/NEWS index 2f71a374..cb02aee9 100644 --- a/NEWS +++ b/NEWS @@ -122,7 +122,7 @@ What's new in psycopg 2.4.6 - 'register_hstore()', 'register_composite()', 'tpc_recover()' work with RealDictConnection and Cursor (:ticket:`#114`). - Fixed broken pool for Zope and connections re-init across ZSQL methods - in the same request (tickets #123, #125, #142). + in the same request (:tickets:`#123, #125, #142`). - connect() raises an exception instead of swallowing keyword arguments when a connection string is specified as well (:ticket:`#131`). - Discard any result produced by 'executemany()' (:ticket:`#133`). @@ -144,7 +144,7 @@ What's new in psycopg 2.4.5 - Error and its subclasses are picklable, useful for multiprocessing interaction (:ticket:`#90`). - Better efficiency and formatting of timezone offset objects thanks - to Menno Smits (tickets #94, #95). + to Menno Smits (:tickets:`#94, #95`). - Fixed 'rownumber' during iteration on cursor subclasses. Regression introduced in 2.4.4 (:ticket:`#100`). - Added support for 'inet' arrays. diff --git a/doc/src/tools/lib/ticket_role.py b/doc/src/tools/lib/ticket_role.py index 28900661..d8ded227 100644 --- a/doc/src/tools/lib/ticket_role.py +++ b/doc/src/tools/lib/ticket_role.py @@ -8,45 +8,52 @@ :copyright: Copyright 2013 by Daniele Varrazzo. """ +import re from docutils import nodes, utils from docutils.parsers.rst import roles def ticket_role(name, rawtext, text, lineno, inliner, options={}, content=[]): - try: - num = int(text.replace('#', '')) - except ValueError: - msg = inliner.reporter.error( - "ticket number must be... a number, got '%s'" % text) - prb = inliner.problematic(rawtext, rawtext, msg) - return [prb], [msg] - cfg = inliner.document.settings.env.app.config - url_pattern = cfg.ticket_url - if url_pattern is None: + if cfg.ticket_url 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 + rv = [nodes.Text(name + ' ')] + tokens = re.findall(r'(#?\d+)|([^\d#]+)', text) + for ticket, noise in tokens: + if ticket: + num = int(ticket.replace('#', '')) + + # 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 = cfg.ticket_url % num + roles.set_classes(options) + node = nodes.reference(ticket, utils.unescape(ticket), + refuri=url, **options) + + rv.append(node) + + else: + assert noise + rv.append(nodes.Text(noise)) + + return rv, [] - url = url_pattern % num - roles.set_classes(options) - node = nodes.reference(rawtext, 'ticket ' + utils.unescape(text), - refuri=url, **options) - return [node], [] 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) + app.add_role('tickets', ticket_role) From a676b7d08fd60827b3e882ca7f2912f8d198c4da Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 28 Aug 2014 13:21:33 +0100 Subject: [PATCH 3/3] Migrate more tickets and further away Starting the import operation now... --- doc/src/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/conf.py b/doc/src/conf.py index 6c26fcbe..78d2c154 100644 --- a/doc/src/conf.py +++ b/doc/src/conf.py @@ -67,8 +67,8 @@ intersphinx_mapping = { # Pattern to generate links to the bug tracker ticket_url = 'https://github.com/psycopg/psycopg2/issues/%s' -ticket_remap_until = 20 -ticket_remap_offset = 230 +ticket_remap_until = 25 +ticket_remap_offset = 235 # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.