-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a simple SVN link extension that links entries in the form
* repo 123456 * repo r123456 * repo #123456 to the corresponding FreeBSD SVN changeset. Supported repositories are base, ports, doc for now.
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package Bugzilla::Extension::SVNLinks; | ||
| use strict; | ||
|
|
||
| use constant NAME => 'SVNLinks'; | ||
|
|
||
| use constant REQUIRED_MODULES => [ | ||
| ]; | ||
|
|
||
| use constant OPTIONAL_MODULES => [ | ||
| ]; | ||
|
|
||
| __PACKAGE__->NAME; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package Bugzilla::Extension::SVNLinks; | ||
|
|
||
| use strict; | ||
| use warnings; | ||
|
|
||
| use base qw(Bugzilla::Extension); | ||
|
|
||
| use constant { | ||
| SVN_PORTS => "http://svnweb.freebsd.org/changeset/ports/", | ||
| SVN_BASE => "http://svnweb.freebsd.org/changeset/base/", | ||
| SVN_DOC => "http://svnweb.freebsd.org/changeset/doc/", | ||
| }; | ||
|
|
||
| our $VERSION = '0.1.0'; | ||
|
|
||
| sub bug_format_comment { | ||
| my ($self, $args) = @_; | ||
| my $regexes = $args->{regexes}; | ||
|
|
||
| push(@$regexes, { | ||
| match => qr/ports\s*\#?\s*r?(\d+)/i, | ||
| replace => \&_link_ports | ||
| }); | ||
| push(@$regexes, { | ||
| match => qr/base\s*\#?\s*r?(\d+)/i, | ||
| replace => \&_link_base | ||
| }); | ||
| push(@$regexes, { | ||
| match => qr/doc\s*\#?\s*r?(\d+)/i, | ||
| replace => \&_link_doc | ||
| }); | ||
| } | ||
|
|
||
| sub _link_ports { | ||
| my $rev = $1 || ""; | ||
| my $link = "<a href=\"" . SVN_PORTS . | ||
| "$rev\" title=\"revision $rev in ports\">ports r$rev</a>"; | ||
| } | ||
|
|
||
| sub _link_base { | ||
| my $rev = $1 || ""; | ||
| my $link = "<a href=\"" . SVN_BASE . | ||
| "$rev\" title=\"revision $rev in base\">base r$rev</a>"; | ||
| } | ||
|
|
||
| sub _link_doc { | ||
| my $rev = $1 || ""; | ||
| my $link = "<a href=\"" . SVN_DOC . | ||
| "$rev\" title=\"revision $rev in doc\">doc r$rev</a>"; | ||
| } | ||
|
|
||
| __PACKAGE__->NAME; |
Empty file.