On compatibilise git-notify avec les urls gitlab.
* Il faut penser à changer l'attribut baseurl * Il faut ajouter isgitlab = 1 * Il faut préciser gitlabowner = membres-actifs ou gitlabowner = nounous Etc etc.
This commit is contained in:
parent
18b7e20efb
commit
351565faaf
1 changed files with 10 additions and 5 deletions
|
@ -52,6 +52,10 @@ my $debug = 0;
|
||||||
# base URL of the gitweb repository browser (can be set with the -u option)
|
# base URL of the gitweb repository browser (can be set with the -u option)
|
||||||
my $gitweb_url = git_config( "notify.baseurl" );
|
my $gitweb_url = git_config( "notify.baseurl" );
|
||||||
|
|
||||||
|
# The git server is behind gitlab
|
||||||
|
my $is_gitlab = git_config( "notify.isgitlab" ) || "";
|
||||||
|
my $gitlab_owner = git_config( "notify.gitlabowner" ) || "";
|
||||||
|
|
||||||
# default repository name (can be changed with the -r option)
|
# default repository name (can be changed with the -r option)
|
||||||
my $repos_name = git_config( "notify.repository" ) || get_repos_name();
|
my $repos_name = git_config( "notify.repository" ) || get_repos_name();
|
||||||
|
|
||||||
|
@ -147,6 +151,7 @@ sub parse_options()
|
||||||
elsif ($arg eq '-r') { $repos_name = shift @ARGV; }
|
elsif ($arg eq '-r') { $repos_name = shift @ARGV; }
|
||||||
elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
|
elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
|
||||||
elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; }
|
elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; }
|
||||||
|
elsif ($arg eq '-g') { $is_gitlab = shift @ARGV; }
|
||||||
elsif ($arg eq '-i') { push @include_list, shift @ARGV; }
|
elsif ($arg eq '-i') { push @include_list, shift @ARGV; }
|
||||||
elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; }
|
elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; }
|
||||||
elsif ($arg eq '-X') { push @revlist_options, "--no-merges"; }
|
elsif ($arg eq '-X') { push @revlist_options, "--no-merges"; }
|
||||||
|
@ -260,7 +265,7 @@ sub send_commit_notice($$)
|
||||||
"Module: $repos_name",
|
"Module: $repos_name",
|
||||||
"Branch: $ref",
|
"Branch: $ref",
|
||||||
"Tag: $obj",
|
"Tag: $obj",
|
||||||
$gitweb_url ? "URL: $gitweb_url;a=tag;h=$obj\n" : "",
|
$gitweb_url ? "URL: $gitweb_url". ($is_gitlab ? "/tag/$obj\n" : ";a=tag;h=$obj\n") : "",
|
||||||
"Tagger: " . $info{"tagger"},
|
"Tagger: " . $info{"tagger"},
|
||||||
"Date: " . format_date($info{"tagger_date"},$info{"tagger_tz"}),
|
"Date: " . format_date($info{"tagger_date"},$info{"tagger_tz"}),
|
||||||
"",
|
"",
|
||||||
|
@ -273,7 +278,7 @@ sub send_commit_notice($$)
|
||||||
"Module: $repos_name",
|
"Module: $repos_name",
|
||||||
"Branch: $ref",
|
"Branch: $ref",
|
||||||
"Commit: $obj",
|
"Commit: $obj",
|
||||||
$gitweb_url ? "URL: $gitweb_url;a=commit;h=$obj\n" : "",
|
$gitweb_url ? "URL: $gitweb_url". ($is_gitlab ? "/commit/$obj\n" : ";a=commit;h=$obj\n") : "",
|
||||||
"Author: " . $info{"author"},
|
"Author: " . $info{"author"},
|
||||||
"Date: " . format_date($info{"author_date"},$info{"author_tz"}),
|
"Date: " . format_date($info{"author_date"},$info{"author_tz"}),
|
||||||
"",
|
"",
|
||||||
|
@ -296,7 +301,7 @@ sub send_commit_notice($$)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
push @notice, "Diff: $gitweb_url;a=commitdiff;h=$obj" if $gitweb_url;
|
push @notice, "Diff: $gitweb_url". ($is_gitlab ? "/commit/$obj" : ";a=commit;h=$obj") if $gitweb_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
$subject = "Git commit ($repos_name/$ref): " . ${$info{"log"}}[0];
|
$subject = "Git commit ($repos_name/$ref): " . ${$info{"log"}}[0];
|
||||||
|
@ -352,7 +357,7 @@ sub send_cia_notice($$)
|
||||||
|
|
||||||
push @cia_text,
|
push @cia_text,
|
||||||
" </files>",
|
" </files>",
|
||||||
$gitweb_url ? " <url>" . xml_escape("$gitweb_url;a=commit;h=$commit") . "</url>" : "",
|
$gitweb_url ? " <url>" . xml_escape("$gitweb_url". ($is_gitlab ? "/commit/$commit" : ";a=commit;h=$commit")) . "</url>" : "",
|
||||||
" </commit>",
|
" </commit>",
|
||||||
" </body>",
|
" </body>",
|
||||||
" <timestamp>" . $info{"author_date"} . "</timestamp>",
|
" <timestamp>" . $info{"author_date"} . "</timestamp>",
|
||||||
|
@ -422,7 +427,7 @@ sub send_all_notices($$$)
|
||||||
parse_options();
|
parse_options();
|
||||||
|
|
||||||
# append repository path to URL
|
# append repository path to URL
|
||||||
$gitweb_url .= "?p=$repos_name.git" if $gitweb_url;
|
$gitweb_url .= $gitweb_url ? $is_gitlab ? "/$gitlab_owner/$repos_name" : "?p=$repos_name.git" : "";
|
||||||
|
|
||||||
if (@ARGV)
|
if (@ARGV)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue