Version 1 (modified by HumanInternals, 13 years ago) (diff)

New hack RepoRevisionSyntaxPlugin, created by shesek

WikiSyntax for multiple repository revision


When multiple repositories are configured, the 'r123' syntax doesn't enable you to specify the repository and the [changeset:123:repo] or [123/repo] syntax must be used instead. As I do find the 'r123' syntax more readable, I wrote this small plugin that lets you use 'r123repo' (simply add the repository name right after the changeset number).

This is displayed as 'repo/r123' with a link to the changeset. Parsing 'repo/r123' syntax isn't possible (AFAIK) as the built-in parser parses the 'r123' part, so the syntax is 'r123repo' but it displayed as 'repo/r123'.

This is the quick solution I came up with. Simply drop this as a .py file directly in your plugins directory:

from trac.core import *
from import IWikiSyntaxProvider
from genshi.builder import tag

class RepoRevisionSyntax(Component):
    # -- IWikiSyntaxProvider
    def get_wiki_syntax(self):
        yield ( r'[r#](?P<rev_id>\d+)(?:\/|@)?(?P<repo>[a-zA-Z0-9_\/]+)', self._format_regex_link)
    def _format_regex_link(self, formatter, ns, match):
        return tag.a('%s/r%s' % ('repo'),'rev_id')),

Bugs/Feature Requests

Existing bugs and feature requests for RepoRevisionSyntaxPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:reporevisionsyntaxplugin here].


You can check out RepoRevisionSyntaxPlugin from here using Subversion, or browse the source with Trac.


For example, 'Fixed by r78trac' (as a ticket comment) would be get displayed as 'Fixed by trac/r78' with a link.

Recent Changes

8337 by shesek on 2010-08-05 18:54:27
New hack RepoRevisionSyntaxPlugin, created by shesek


Author: shesek
Maintainer: shesek