Add support for gitea links

If we want to link directly to opendev urls, we need gerrit to
understand what the link structure looks like. Add support.

Change-Id: I8efefe365f3b9ebe97c8c2ce322fa8c6f3b70b3a
This commit is contained in:
Monty Taylor 2019-04-20 18:15:01 +00:00
parent a7422e3645
commit 0d533a9a94
2 changed files with 15 additions and 2 deletions

View File

@ -128,6 +128,8 @@
# A boolean enabling gitweb
# cgit:
# A boolean enabling cgit
# gitae:
# A boolean enabling gitea
# web_repo_url:
# Url for setting the location of an external git browser
# web_repo_url_encode:
@ -255,6 +257,7 @@ class gerrit(
$replication = [],
$gitweb = true,
$cgit = false,
$gitea = false,
$web_repo_url = '',
$web_repo_url_encode = true,
$testmode = false,

View File

@ -191,11 +191,12 @@
# Gerrit upstream hardcodes a .git extension for cgit.
# The cgit settings below are the same just without the
# .git extension.
<% if @gitweb or @cgit -%>
<% if @gitweb or @cgit or @gitea -%>
[gitweb]
<% if @gitweb -%>
revision = "?p=${project}.git;a=commitdiff;h=${commit}"
<% else -%>
<% end -%>
<% if @cgit -%>
type = custom
project = "${project}/summary"
revision = "${project}/commit/?id=${commit}"
@ -204,6 +205,15 @@
file = "${project}/tree/${file}?h=${commit}"
filehistory = "${project}/log/${file}?h=${branch}"
<% end -%>
<% if @gitea -%>
type = custom
project = "${project}"
revision = "${project}/commit/${commit}"
branch = "${project}/src/branch/${branch}"
roottree = "${project}/src/commit/${commit}"
file = "${project}/src/commit/${commit}/${file}"
filehistory = "${project}/commits/branch/${branch}/${file}"
<% end -%>
<% if scope.lookupvar("gerrit::web_repo_url") -%>
url = "<%= scope.lookupvar('gerrit::web_repo_url') %>"
urlEncode = <%= @web_repo_url_encode %>