diff --git a/.gitlab-ci/version.pl b/.gitlab-ci/version.pl index 7fa0e1324..8a2e277a7 100755 --- a/.gitlab-ci/version.pl +++ b/.gitlab-ci/version.pl @@ -70,6 +70,11 @@ my %parKinds = ( def=>'', help=>'Use this file name to write the changelog to, but use "changelog" to read the old changelog. If not set for both versions the parameter changelog is used.', }, + autovcsurl=>{ + arity=>1, + def=>q#git ls-remote --get-url origin | sed 's/[^@]*@\([^:]*\):\(.*\)\.git$/https:\/\/\1\/\2/'#, + help=>'Automated computation for vcsurl. If both values are set then vcsurl is used."', + }, vcsurl=>{ arity=>1, def=>'', @@ -163,6 +168,12 @@ for my $as(split /,/, $par{change}) { } } +if($par{autovcsurl} and not $par{vcsurl}) { + $par{vcsurl} = qx($par{autovcsurl}); + chomp $par{vcsurl}; + $par{vcsurl}=~s#/*$#/# +} + if($par{changelog} and not $par{vcsurl}) { die "Parameter 'changelog' given, but parameter 'vcsurl' is not. Please state the url of your repository for computation of a changelog.\n" } @@ -576,7 +587,7 @@ if($par{changelog}) { } #print Data::Dumper::Dumper(\%extend); my $preVersion = ''; - if($sects[0][0]=~m/^##\s*\[([^\]\[]+)\]\(/) { + if(defined $sects[0] and defined $sects[0][0] and $sects[0][0]=~m/^##\s*\[([^\]\[]+)\]\(/) { $preVersion = $1; $preVersion =~ s#^v?#v#; }