[bugzilla-gnome-org-customizations/wip/xclaesse/branch] Automatically link Git wip/ branches to the corresponding URL
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-customizations/wip/xclaesse/branch] Automatically link Git wip/ branches to the corresponding URL
- Date: Thu, 5 Feb 2015 20:21:40 +0000 (UTC)
commit ad6dd4528ebdf678f765877c2c0bdd3804481356
Author: Xavier Claessens <xavier claessens collabora com>
Date: Thu Feb 5 15:16:48 2015 -0500
Automatically link Git wip/ branches to the corresponding URL
Automatically link "branch wip/$branch" to the corresponding URL for that branch
on https://git.gnome.org. The URL construction relies on the product name of the
Bugzilla report so if the name in Bugzilla does not match the repository name in
Git the URL will be a 404. So you might want to make sure that names are the
same in Bugzilla
extensions/GNOME/Extension.pm | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/extensions/GNOME/Extension.pm b/extensions/GNOME/Extension.pm
index 0ad6f30..46144ff 100644
--- a/extensions/GNOME/Extension.pm
+++ b/extensions/GNOME/Extension.pm
@@ -318,15 +318,27 @@ sub bug_format_comment {
replace => sub { _createGitCommitLink($self, $args); }
};
push( @$regexes, $replacerGitCommit );
+
+ my $replacerGitBranch = {
+ match => qr{(\sbranch\s)(wip/[\w\-\/]+)}i,
+ replace => sub { _createGitBranchLink($self, $args); }
+ };
+ push( @$regexes, $replacerGitBranch );
}
}
sub _createGitCommitLink {
-
my ($self, $args) = @_;
my $productname = $args->{'bug'}->product;
my $commit_link = join("", $1, '<a href="https://git.gnome.org/browse/', url_quote($productname),
'/commit/?id=', $2, '">', $2, '</a>');
return $commit_link;
};
+sub _createGitBranchLink {
+ my ($self, $args) = @_;
+ my $productname = $args->{'bug'}->product;
+ my $branch_link = join("", $1, '<a href="https://git.gnome.org/browse/', url_quote($productname),
'/log/?h=', $2, '">', $2, '</a>');
+ return $branch_link;
+};
+
__PACKAGE__->NAME;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]