Plugin support for revision weblink

Support for an extension point that allows for weblinks to
several external tools.

First effort, weblinks for patch sets.

At the present time GitWebLink is integrated. But the aim is to
extend support to engulf entire GitWebLink and provide backwards
support by adding a plugin that has the same functionality as
GitWebLink has today.

Change-Id: I19f4d00325d2991df9514ee8833a8873649c27bc
This commit is contained in:
Sven Selberg
2014-02-14 14:24:29 +01:00
committed by David Pursehouse
parent 1724b8d2cc
commit ae1a10ce48
14 changed files with 269 additions and 16 deletions

View File

@@ -1706,6 +1706,39 @@ commands by implementing
The download schemes and download commands which are used most often
are provided by the Gerrit core plugin `download-commands`.
[[links-to-external-tools]]
== Links To External Tools
Gerrit has extension points that enables development of a
light-weight plugin that links commits to external
tools (GitBlit, CGit, company specific resources etc).
PatchSetWebLinks will appear to the right of the commit-SHA1 in the UI.
[source, java]
----
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.extensions.webui.PatchSetWebLink;;
@Listen
public class MyWeblinkPlugin implements PatchSetWebLink {
private String name = "MyLink";
private String placeHolderUrlProjectCommit = "http://my.tool.com/project=%s/commit=%s";
@Override
public String getLinkName() {
return name ;
}
@Override
public String getPatchSetUrl(String project, String commit) {
return String.format(placeHolderUrlProjectCommit, project, commit);
}
}
----
[[documentation]]
== Documentation

View File

@@ -242,6 +242,11 @@ default. Optional fields are:
authenticated and has commented on the current revision.
--
[[patch-set-links]]
--
* `PATCHSET_LINKS`: include the webLinks field.
--
.Request
----
GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES&o=DOWNLOAD_COMMANDS HTTP/1.0
@@ -3243,6 +3248,8 @@ link:#file-info[FileInfo] entities.
Actions the caller might be able to perform on this revision. The
information is a map of view name to link:#action-info[ActionInfo]
entities.
|'webLinks' |optional|
Links to patch set in external tools as a list.
|===========================
[[rule-input]]