Index: viewcvs/cgi/viewcvs.conf.dist =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/cgi/viewcvs.conf.dist,v retrieving revision 1.41 diff -u -r1.41 viewcvs.conf.dist --- viewcvs/cgi/viewcvs.conf.dist 31 Dec 2001 04:39:34 -0000 1.41 +++ viewcvs/cgi/viewcvs.conf.dist 3 Mar 2002 17:26:36 -0000 @@ -435,6 +435,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: viewcvs/lib/config.py =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/lib/config.py,v retrieving revision 1.38 diff -u -r1.38 config.py --- viewcvs/lib/config.py 20 Feb 2002 07:11:48 -0000 1.38 +++ viewcvs/lib/config.py 3 Mar 2002 17:26:36 -0000 @@ -204,6 +204,9 @@ self.options.cvsgraph_conf = "/cvsgraph.conf" self.options.use_re_search = 0 self.options.use_pagesize = 0 + self.options.bug_match = 0 + self.options.bug_prefix = '' + self.options.bug_system_expr = '' def is_forbidden(self, module): if not module: Index: viewcvs/lib/query.py =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/lib/query.py,v retrieving revision 1.10 diff -u -r1.10 query.py --- viewcvs/lib/query.py 19 Nov 2001 11:15:18 -0000 1.10 +++ viewcvs/lib/query.py 3 Mar 2002 17:26:36 -0000 @@ -290,7 +290,7 @@ ob = _item(num_files=len(files), files=[]) if desc: - ob.desc = string.replace(cgi.escape(desc), '\n', '
') + ob.desc = viewcvs.bugify(string.replace(cgi.escape(desc), '\n', '
')) else: ob.desc = ' ' Index: viewcvs/lib/viewcvs.py =================================================================== RCS file: /cvsroot/viewcvs/viewcvs/lib/viewcvs.py,v retrieving revision 1.107 diff -u -r1.107 viewcvs.py --- viewcvs/lib/viewcvs.py 22 Feb 2002 09:20:46 -0000 1.107 +++ viewcvs/lib/viewcvs.py 3 Mar 2002 17:26:36 -0000 @@ -360,8 +360,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 @@ -630,7 +636,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)), }) @@ -1701,7 +1707,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, [ ])