Bazaar Webserve modifications
Goffredo Baroncelli
kreijack at alice.it
Tue Sep 26 23:16:18 BST 2006
Hello Martijn,
On Monday 28 August 2006 22:39, Goffredo Baroncelli wrote:
> On Friday 25 August 2006 23:45, Martijn van der Kwast wrote:
> > Hello Goffredo,
[...]
> >
> > - I would like to automatically convert sequences like 'issue: 23' or
> > 'bug: 23' to links to their bug-tracker page. It would be a quick hack
> > to make that work for my site, but maybe it's a feature that would
> > interest other users, and it could be interesting to make it more generic.
>
> I think that with a filter that support the sed/perl syntax, we can do what
> you want
>
>
> As example:
>
> commentFilter=replace:what="bug:
> ([0-9]*)","http://bugzilla.web.net/bugid=\1";replace:what="issue:
> ([0-9]*)","http://bugzilla.web.net/issueid=\1"
>
>
> So, we can do replace like
> bug123 -> http://bugzilla.web.net/bugid=123
> issue123 -> http://bugzilla.web.net/issueid=123
>
>
> We can express these filter, globally, or per basis group or per repository.
> in the future we can have filter like
>
> commentFilter=plugin:/path/to/plugin.py
>
I worked on this idea; see this revision
http://goffredo-baroncelli.homelinux.net/bazaar-dev/bazaar-webserve-dev?cmd=revision;revid=ghigo%40venice-20060903172053-e6343fedd1812cd4
If I add in the config file the option "commentfilter" I am able to replace
the text in the comment. For example in my test I added the following rule (
one line )
commentfilter = replace:@bugid:([0-9]*)@<a
href=http://bugzilla/bugid=\1>bugid:\1</a>@;;replace:@test:([0-9]*)@<a
href=http://bugzilla/test=\1>test:\1</a>@
So every occurence of bugid:XYZ is replaced with a URL pointing to
http://bugzilla/bugid=XYZ
And every occurence of test:XYZ is replaced with a URL pointing to
http://bugzilla/test=XYZ
Every rule is separed by a ";;"; the syntax is :
<command>:<parameters>
For now only the command "replace" is implemented. For the command "replace:"
the syntax of <parameters> is
<separator><reg-ex><separator><replace-string><separator>
where
<separator> is a arbitrary character ( '@' in my examples )
<reg-ex> is a regular expression that is used to select the string that
will be replaced
<replace-string> is the string that will be inserted
Comments are welcome.
Goffredo
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo)
<kreijack_AT_inwind.it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87 87C0 BB86 505C 6B2A CFF9
More information about the bazaar
mailing list