diff options
author | David Lawrence <dkl@mozilla.com> | 2016-06-28 23:14:21 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2016-06-28 23:15:08 +0200 |
commit | e0ab47259dc188979e899f1fef5c5c7d6344e0d8 (patch) | |
tree | da3d76421fc5cb0a116d9b5f974b84b9cade11e2 /extensions/BMO/Extension.pm | |
parent | 557410f34c224543c0afb8686f995fca3297bc68 (diff) | |
download | bugzilla-e0ab47259dc188979e899f1fef5c5c7d6344e0d8.tar.gz bugzilla-e0ab47259dc188979e899f1fef5c5c7d6344e0d8.tar.xz |
Bug 1281479 - Rewrite references to git commits to point to github
Diffstat (limited to 'extensions/BMO/Extension.pm')
-rw-r--r-- | extensions/BMO/Extension.pm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 5a9f8c4fa..8bf430529 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -677,7 +677,7 @@ sub bug_format_comment { } }); - # link git.mozilla.org commit messages + # link old git.mozilla.org commit messages to github push (@$regexes, { match => qr#^(To\s(?:ssh://)?(?:[^\@]+\@)?git\.mozilla\.org[:/](.+?\.git)\n \s+)([0-9a-z]+\.\.([0-9a-z]+)\s+\S+\s->\s\S+)#mx, @@ -687,7 +687,24 @@ sub bug_format_comment { my $repo = html_quote($args->{matches}->[1]); my $text = $args->{matches}->[2]; my $revision = $args->{matches}->[3]; - return qq#$preamble<a href="https://git.mozilla.org/?p=$repo;a=commitdiff;h=$revision">$text</a>#; + $repo = 'mozilla/webtools-bmo-bugzilla' if $repo =~ /^webtools\/bmo\/bugzilla/; + $repo = 'bugzilla/bugzilla' if $repo =~ /^bugzilla\/bugzilla\.git/; + $repo = 'bugzilla/bugzilla.org' if $repo =~ /^www\/bugzilla\.org/; + return qq#$preamble<a href="https://github.com/$repo/commit/$revision">$text</a>#; + } + }); + + # link github commit messages + push (@$regexes, { + match => qr#^(To\s(?:https://)?github\.com/(.+?)\.git\n + \s+)([0-9a-z]+\.\.([0-9a-z]+)\s+\S+\s->\s\S+)#mx, + replace => sub { + my $args = shift; + my $preamble = html_quote($args->{matches}->[0]); + my $repo = html_quote($args->{matches}->[1]); + my $text = $args->{matches}->[2]; + my $revision = $args->{matches}->[3]; + return qq#$preamble<a href="https://github.com/$repo/commit/$revision">$text</a>#; } }); |