Opened 10 years ago

Closed 8 days ago

# Allow links to legacy Bugzilla tickets

Reported by: Owned by: r.d.wilkerson@… javajunky normal BugzillaIssueTrackingPlugin minor 0.9

### Description

We're in the process of moving from Bugzilla to Trac and have made the decision not to import existing bugs to prevent the introduction of a lot of garbage into our shiny new Trac installation. Instead, we'll be using TracTickets for new bugs and simply referencing Bugzilla for legacy bug entries. It would be great if we could access either through Trac. Perhaps retaining the "#" notation for referencing Trac tickets and adding "BZ#" notation for Bugzilla tickets?

Of course, I have no idea whether this is possible, but it would be a really nice addition.

### comment:1 Changed 10 years ago by felmasper

If you are moving your svn into Trac, then you need to change commit messages, this will be a hard work.

This is an example of how to accept other forms. You must have a space before # for Trac tickets to work. I didn't test this code... I don't even remember if it's "or" or "
 " in Python :-) You get the idea...
    def get_wiki_syntax(self):
yield ("(?P<bs>BZ#| #)(?P<ti>\d+)", lambda x, y, z: self._format_symbol(z.group("ti"),z.group("bs")))

return []

def _format_symbol(self, i, bugscheme):
bugzilla_url= self.env.config.get('bugzilla', 'bugzilla_url', 'http://tutoo.las.ic.unicamp.br/bugzilla');
if (bugscheme == " #"):
return " <a rel='nofollow' class='ticket' href='ticket/%s'>#%s</a>" % (i, i);
else:
return "<a rel='nofollow' class='ticket' href='%s/show_bug.cgi?id=%s'>BZ#%s</a>" % (bugzilla_url, i, i);

Last edited 8 days ago by rjollos (previous) (diff)

### comment:2 Changed 6 years ago by manuel@…

A working solution for this is to use the RegexLinkPlugin with the following configuration:

[regexlink]
regex1=\bbug (?P<bug_id_comment>\d+) comment #(?P<commentid>\d+)\b
url1=http://your.trac.instance.com/ticket/\g<bug_id_comment>#comment:\g<commentid>
regex2=\bbug (?P<bug_id>\d+)\b
url2=http://your.trac.instance.com/ticket/\g<bug_id>


This will correctly link all bug X and bug X comment Y links to the equivalent trac URLs

Last edited 8 days ago by rjollos (previous) (diff)

### comment:3 Changed 8 days ago by rjollos

• Resolution set to worksforme
• Status changed from new to closed