Jenkins : Repository browser

Adding repository browsers to the SCM is useful if there are web based repository browsers that can display more information about the change set or the SCM in general. Examples of repository browsers are FishEye, viewvc and sventon.

SCM implementation

Class changes


Create a class, that extends RepositoryBrowser<ChangeLogSet.Entry> for your SCM that will act as the base class for each repository browser implementation. The abstract method is getChangeSetLink() that returns an URL. But if your repository browser can show other information, such as difference of a file between change sets or the file itself, then you should add abstract methods in your repository browser class.

SCM class

Add a field for storing the repository browser.

public class TeamFoundationServerScm extends SCM {
    private TeamFoundationServerRepositoryBrowser repositoryBrowser;
    public TeamFoundationServerRepositoryBrowser getBrowser() {
        return repositoryBrowser;

SCM Descriptor changes

The configuration of the SCM class must also be updated to support the new repository browser. The constructor must set the repository browser responsible for the SCM and the newInstance() method must be overridden to retrieve which repository browser to use.

public static class DescriptorImpl extends SCMDescriptor<TeamFoundationServerScm> {
    protected DescriptorImpl() {
        super(TeamFoundationServerScm.class, TeamFoundationServerRepositoryBrowser.class);
    public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException {
        TeamFoundationServerScm scm = (TeamFoundationServerScm) super.newInstance(req, formData);
        scm.repositoryBrowser = RepositoryBrowsers.createInstance(
        return scm;

Jelly files


Add the following section to the config.jelly that is used for configuring the SCM.

  <t:listScmBrowsers name="tfs.browser" />  


The index jelly for the ChangeLogSet must be updated to include the links to the repository browser.

<j:jelly ...>
  <j:set var="browser" value="${}"/>
          <div class="changeset-message">
              <a href="${browser.getChangeSetLink(cs)}">${cs.version}</a> 
              by <a href="${rootURL}/${}/">${cs.user}</a>
              <j:if test="${cs.domain!=null}">

Adding a repository browser

Adding a repository browser to the SCM, is simple by adding two files, the class extending the RepositoryBrowser class and the jelly file for configuring it.


public class CodePlexTfsBrowser extends TeamFoundationServerRepositoryBrowser {

    public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();
    public final URL url;

    public CodePlexTfsBrowser(URL url) {
        this.url = normalizeToEndWithSlash(url);
    public Descriptor<RepositoryBrowser<?>> getDescriptor() {
        return DESCRIPTOR;

    public URL getChangeSetLink(ChangeSet changeSet) throws IOException {
        return new URL(url, "?SourcePath=&changeSetId=" + changeSet.getVersion());

    public static class DescriptorImpl extends Descriptor<RepositoryBrowser<?>> {
        protected DescriptorImpl() {
        public String getDisplayName() {
            return "CodePlex";


The repository browser must be configured with the base URL, so it can be used when determining the URL to link the change set to. The jelly files goes into src/main/resources/hudson/plugins/[SCM]/browsers/CodePlexTfsBrowser folder.

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
  <f:entry title="URL" help="/help/scm-browsers/codeplex-tfs/url.html">
    <f:textbox name="codeplex.tfs.url" value="${browser.url}"/>