From e0ab47259dc188979e899f1fef5c5c7d6344e0d8 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 28 Jun 2016 21:14:21 +0000 Subject: Bug 1281479 - Rewrite references to git commits to point to github --- extensions/BMO/Extension.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'extensions') 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$text#; + $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$text#; + } + }); + + # 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$text#; } }); -- cgit v1.2.3-24-g4f1b