Module: tools Branch: master Commit: 49820276eb62e54265aa99a424c5be80a19817d2 URL: https://gitlab.winehq.org/winehq/tools/-/commit/49820276eb62e54265aa99a424c5...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Jul 11 13:08:54 2022 +0200
git-notify: Add support for using Gitlab URLs in notifications.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
git-notify | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/git-notify b/git-notify index 91f29a65..7bfb2139 100755 --- a/git-notify +++ b/git-notify @@ -48,6 +48,9 @@ my $debug = 0; # base URL of the gitweb repository browser (can be set with the -u option) my $gitweb_url = git_config( "notify.baseurl" );
+# URL of the gitlab repository (can be set with the -g option) +my $gitlab_url = git_config( "notify.gitlab" ); + # default repository name (can be changed with the -r option) my $repos_name = git_config( "notify.repository" ) || get_repos_name();
@@ -76,7 +79,8 @@ sub usage() print " -n max Set max number of individual mails to send\n"; print " -r name Set the git repository name\n"; print " -s bytes Set the maximum diff size in bytes (-1 for no limit)\n"; - print " -u url Set the URL to the gitweb browser\n"; + print " -g url Set the URL of the gitlab project\n"; + print " -u url Set the URL of the gitweb browser\n"; print " -i branch If at least one -i is given, report only for specified branches\n"; print " -x branch Exclude changes to the specified branch from reports\n"; print " -X Exclude merge commits\n"; @@ -137,6 +141,7 @@ sub parse_options() elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; } elsif ($arg eq '-r') { $repos_name = shift @ARGV; } elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; } + elsif ($arg eq '-g') { $gitlab_url = shift @ARGV; } elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; } elsif ($arg eq '-i') { push @include_list, shift @ARGV; } elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; } @@ -242,6 +247,7 @@ sub send_commit_notice($$) "Module: $repos_name", "Branch: $ref", "Tag: $obj", + $gitlab_url ? "URL: $gitlab_url/tags/$obj\n" : $gitweb_url ? "URL: $gitweb_url/?a=tag;h=$obj\n" : "", "Tagger: " . $info{"tagger"}, "Date: " . format_date($info{"tagger_date"},$info{"tagger_tz"}), @@ -255,6 +261,7 @@ sub send_commit_notice($$) "Module: $repos_name", "Branch: $ref", "Commit: $obj", + $gitlab_url ? "URL: $gitlab_url/commit/$obj\n" : $gitweb_url ? "URL: $gitweb_url/?a=commit;h=$obj\n" : "", "Author: " . $info{"author"}, "Date: " . format_date($info{"author_date"},$info{"author_tz"}), @@ -298,6 +305,7 @@ sub send_global_notice($$$) while (<LIST>) { chomp; + s/^commit /URL: $gitlab_url/commit// if $gitlab_url; s/^commit /URL: $gitweb_url/?a=commit;h=/ if $gitweb_url; push @notice, $_; } @@ -348,6 +356,7 @@ parse_options();
# append repository path to URL $gitweb_url .= "/$repos_name.git" if $gitweb_url; +$gitlab_url .= "/-" if $gitlab_url;
if (@ARGV) {