=================================================================== RCS file: /cvsroot/viewcvs/viewcvs/viewcvs.conf.dist,v retrieving revision 1.1 diff -u -u -r1.1 viewcvs.conf.dist --- viewcvs.conf.dist 3 Jun 2003 06:24:55 -0000 1.1 +++ viewcvs.conf.dist 3 Jun 2003 11:24:11 -0000 @@ -476,6 +476,38 @@ use_pagesize = 0 # use_pagesize = 20 +# Bug tracking +# +# Set to enable bug-regex matching, to provide links to your bug tracking +# system bsaed on text identified in the log +# Use: +# bug_match = 0 - bug matching disabled +# bug_match = n - match bug numbers of n digits or more +# if you have disabled it here, the bug_prefix and bug_system_expr are +# ignored. + +# bug_match = 1 +bug_match = 0 + + +# Set to narrow the bug matching down to only numbers prefixed with +# regex. Example provided will match (any case) "bug" followed by +# up to 3 non-digit characters. (will match bugzilla's "Bug # " and +# CVSZilla's "Bug: " style) +# + +# bug_prefix = [Bb][Uu][Gg]\D{1,3} +bug_prefix = + +# +# Set to a URL for linking to your bug system. Minimal substitution is provided: +# \1 will be replaced by whatever is matched by "bug_prefix" +# \2 will be replaced by the bug ID (as matched by \d{bug_match}) +# the provided example works with bugzilla + +# bug_system_expr = \1\2 +bug_system_expr = + #--------------------------------------------------------------------------- [vhosts] ### DOC Index: lib/config.py =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/lib/config.py,v retrieving revision 1.50 diff -u -u -r1.50 config.py --- lib/config.py 11 Mar 2003 20:43:06 -0000 1.50 +++ lib/config.py 3 Jun 2003 11:24:12 -0000 @@ -1,6 +1,6 @@ # -*- Mode: python -*- # -# Copyright (C) 2000-2002 The ViewCVS Group. All Rights Reserved. +# Copyright (C) 2000-2003 The ViewCVS Group. All Rights Reserved. # # By using this file, you agree to the terms and conditions set forth in # the LICENSE.html file which can be found at the top level of the ViewCVS @@ -203,6 +203,10 @@ self.options.use_re_search = 0 self.options.use_pagesize = 0 self.options.use_localtime = 0 + self.options.bug_match = 0 + self.options.bug_prefix = '' + self.options.bug_system_expr = '' + def is_forbidden(self, module): if not module: Index: lib/query.py =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/lib/query.py,v retrieving revision 1.15 diff -u -u -r1.15 query.py --- lib/query.py 12 Mar 2003 23:08:08 -0000 1.15 +++ lib/query.py 3 Jun 2003 11:24:13 -0000 @@ -281,7 +281,7 @@ ob = _item(num_files=len(files), files=[]) if desc: - ob.desc = string.replace(server.escape(desc), '\n', '
') + ob.desc = viewcvs.bugify(string.replace(server.escape(desc), '\n', '
')) else: ob.desc = ' ' Index: lib/viewcvs.py =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/lib/viewcvs.py,v retrieving revision 1.164 diff -u -u -r1.164 viewcvs.py --- lib/viewcvs.py 25 May 2003 18:10:18 -0000 1.164 +++ lib/viewcvs.py 3 Jun 2003 11:24:15 -0000 @@ -1,6 +1,6 @@ # -*-python-*- # -# Copyright (C) 1999-2002 The ViewCVS Group. All Rights Reserved. +# Copyright (C) 1999-2003 The ViewCVS Group. All Rights Reserved. # # By using this file, you agree to the terms and conditions set forth in # the LICENSE.html file which can be found at the top level of the ViewCVS @@ -476,8 +476,14 @@ html = re.sub(_re_rewrite_email, r'\1', html) return html +def bugify(bugstr): + if cfg.options.bug_match: + _re_rewrite_bug = "(" + cfg.options.bug_prefix + ")" + "(\d{" + str(cfg.options.bug_match) + ",})" + bugstr = re.sub(_re_rewrite_bug, cfg.options.bug_system_expr, bugstr) + return bugstr + def format_log(log): - s = htmlify(log[:cfg.options.short_log_len]) + s = bugify(htmlify(log[:cfg.options.short_log_len])) if len(log) > cfg.options.short_log_len: s = s + '...' return s @@ -816,7 +822,7 @@ 'tags' : None, 'branch_points' : None, 'changed' : entry.changed, - 'log' : htmlify(entry.log), + 'log' : bugify(htmlify(entry.log)), 'state' : entry.state, 'vendor_branch' : ezt.boolean(_re_is_vendor_branch.match(revision)), }) @@ -1740,7 +1746,7 @@ entry.prev = prev ### maybe just overwrite entry.log? - entry.html_log = htmlify(entry.log) + entry.html_log = bugify(htmlify(entry.log)) if extended: entry.tag_names = rev2tag.get(rev, [ ])