Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1
viewvc
viewvc-buglink.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File viewvc-buglink.patch of Package viewvc
--- conf/viewvc.conf.dist.orig 2011-02-18 19:28:55.000000000 +0100 +++ conf/viewvc.conf.dist 2011-02-19 01:46:36.000000000 +0100 @@ -323,6 +323,21 @@ ##--------------------------------------------------------------------------- [options] +## The 'buglink_base' value is a string that can be used to form a URL +## by appending a bug number. If viewvc sees something that looks +## like a bug number in a log message (eg. "bug 12345" or "#12345"), it +## will be displayed as a link to the bug in your bug tracking system. +## +## For a Bugzilla installation, you probably want to set this to +## something like "http://hostname/show_bug.cgi?id=". For the Debian +## bug tracker, you might use +## "http://hostname/cgi-bin/bugreport.cgi?bug=". +## +## If 'buglink_base' is not set, then bug tracker links won't be +## generated. +## +#buglink_base = http://example.com/show_bug.cgi?id= + ## root_as_url_component: Interpret the first path component in the URL ## after the script location as the root to use. This is an ## alternative to using the "root=" query key. If ViewVC is configured --- lib/viewvc.py.orig 2011-02-18 20:43:26.000000000 +0100 +++ lib/viewvc.py 2011-02-19 01:46:36.000000000 +0100 @@ -1100,6 +1100,10 @@ # Matches revision references _re_rewrite_svnrevref = re.compile(r'\b(r|rev #?|revision #?)([0-9]+)\b') +# Matches bug numbers +_re_rewrite_bug = re.compile(r'((?:\bbug[\s:#+]|[^&]#|^#)\s*(\d\d+))', re.I) +_re_buglink_prefix = "" + class ViewVCHtmlFormatter: """Format a string as HTML-encoded output with customizable markup rules, for example turning strings that look like URLs into anchor links. @@ -1112,6 +1116,19 @@ def __init__(self): self._formatters = [] + def format_bugzilla(self, mobj, userdata, maxlen=0): + """Return a 2-tuple containing: + - the text represented by MatchObject MOBJ, formatted as + linkified URL, with no more than MAXLEN characters in the + non-HTML-tag bits. If MAXLEN is 0, there is no maximum. + - the number of non-HTML-tag characters returned. + """ + s = mobj.group(0) + trunc_s = maxlen and s[:maxlen] or s + return '<a href="%s%s">%s</a>' % (_re_buglink_prefix, urllib.quote(mobj.group(2)), + sapi.escape(trunc_s)), \ + len(trunc_s) + def format_url(self, mobj, userdata, maxlen=0): """Return a 2-tuple containing: - the text represented by MatchObject MOBJ, formatted as @@ -1289,6 +1306,10 @@ escape=1) lf.add_formatter(_re_rewrite_svnrevref, lf.format_svnrevref, revision_to_url) + if cfg.options.buglink_base is not None: + global _re_buglink_prefix + _re_buglink_prefix = cfg.options.buglink_base + lf.add_formatter(_re_rewrite_bug, lf.format_bugzilla); if cfg.options.mangle_email_addresses == 2: lf.add_formatter(_re_rewrite_email, lf.format_email_truncated) elif cfg.options.mangle_email_addresses == 1: --- lib/config.py.orig 2011-02-18 20:27:50.000000000 +0100 +++ lib/config.py 2011-02-19 01:46:56.000000000 +0100 @@ -436,6 +436,7 @@ self.options.log_pagesize = 0 self.options.log_pagesextra = 3 self.options.limit_changes = 100 + self.options.buglink_base = None self.templates.diff = None self.templates.directory = None
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor