Skip to content
Permalink
Browse files

Merge pull request #577 from rsandell/JENKINS-48061

[JENKINS-48061] Add new "Discover other refs" trait, GitBranchSCMHead and GitRefSCMHead
  • Loading branch information...
MarkEWaite committed May 4, 2018
2 parents bd8d2b9 + 0d845c1 commit 927c8295d326a755cc7443f1834d7ff9ede37ee2
Showing with 1,267 additions and 89 deletions.
  1. +1 −1 README.md
  2. +31 −9 pom.xml
  3. +4 −1 src/main/java/hudson/plugins/git/browser/AssemblaWeb.java
  4. +4 −1 src/main/java/hudson/plugins/git/browser/BitbucketWeb.java
  5. +4 −1 src/main/java/hudson/plugins/git/browser/CGit.java
  6. +4 −1 src/main/java/hudson/plugins/git/browser/FisheyeGitRepositoryBrowser.java
  7. +4 −1 src/main/java/hudson/plugins/git/browser/GitBlitRepositoryBrowser.java
  8. +4 −1 src/main/java/hudson/plugins/git/browser/GitLab.java
  9. +4 −1 src/main/java/hudson/plugins/git/browser/GitList.java
  10. +4 −1 src/main/java/hudson/plugins/git/browser/GitWeb.java
  11. +4 −1 src/main/java/hudson/plugins/git/browser/GithubWeb.java
  12. +4 −1 src/main/java/hudson/plugins/git/browser/Gitiles.java
  13. +4 −1 src/main/java/hudson/plugins/git/browser/GitoriousWeb.java
  14. +4 −1 src/main/java/hudson/plugins/git/browser/GogsGit.java
  15. +4 −1 src/main/java/hudson/plugins/git/browser/KilnGit.java
  16. +4 −1 src/main/java/hudson/plugins/git/browser/Phabricator.java
  17. +4 −1 src/main/java/hudson/plugins/git/browser/RedmineWeb.java
  18. +4 −1 src/main/java/hudson/plugins/git/browser/RhodeCode.java
  19. +4 −1 src/main/java/hudson/plugins/git/browser/Stash.java
  20. +4 −1 src/main/java/hudson/plugins/git/browser/TFS2013GitRepositoryBrowser.java
  21. +4 −2 src/main/java/hudson/plugins/git/browser/ViewGitWeb.java
  22. +187 −32 src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
  23. +87 −0 src/main/java/jenkins/plugins/git/GitBranchSCMHead.java
  24. +35 −0 src/main/java/jenkins/plugins/git/GitBranchSCMRevision.java
  25. +65 −0 src/main/java/jenkins/plugins/git/GitRefSCMHead.java
  26. +32 −0 src/main/java/jenkins/plugins/git/GitRefSCMRevision.java
  27. +3 −0 src/main/java/jenkins/plugins/git/GitSCMBuilder.java
  28. +36 −0 src/main/java/jenkins/plugins/git/GitSCMHeadMixin.java
  29. +2 −2 src/main/java/jenkins/plugins/git/GitSCMSource.java
  30. +132 −0 src/main/java/jenkins/plugins/git/GitSCMSourceContext.java
  31. +4 −3 src/main/java/jenkins/plugins/git/GitSCMTelescope.java
  32. +154 −0 src/main/java/jenkins/plugins/git/traits/DiscoverOtherRefsTrait.java
  33. +12 −0 src/main/resources/jenkins/plugins/git/traits/DiscoverOtherRefsTrait/config.jelly
  34. +9 −0 src/main/resources/jenkins/plugins/git/traits/DiscoverOtherRefsTrait/help-nameMapping.html
  35. +4 −0 src/main/resources/jenkins/plugins/git/traits/DiscoverOtherRefsTrait/help-ref.html
  36. +3 −0 src/main/resources/jenkins/plugins/git/traits/DiscoverOtherRefsTrait/help.html
  37. +1 −0 src/main/resources/jenkins/plugins/git/traits/Messages.properties
  38. +234 −19 src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
  39. +84 −0 src/test/java/jenkins/plugins/git/GitBranchSCMHeadTest.java
  40. +22 −2 src/test/java/jenkins/plugins/git/GitSCMFileSystemTest.java
  41. +3 −1 src/test/java/jenkins/plugins/git/GitSCMSourceTest.java
  42. +50 −0 src/test/java/jenkins/plugins/git/traits/DiscoverOtherRefsTraitTest.java
  43. BIN src/test/resources/jenkins/plugins/git/GitBranchSCMHeadTest/testMigrationNoBuildStorm.zip
  44. BIN ...est/resources/jenkins/plugins/git/GitBranchSCMHeadTest/testMigrationNoBuildStorm_repositories.zip
@@ -35,7 +35,7 @@ assure that you haven't introduced new findbugs warnings.

```bash
$ java -version # Need Java 1.8, earlier versions are unsupported for build
$ mvn -version # Need a modern maven version; maven 3.2.5 and 3.5.0 are known to work
$ mvn -version # Need a modern maven version; maven 3.5.0 and later are known to work
$ mvn clean install
```

40 pom.xml
@@ -16,20 +16,19 @@
</licenses>

<artifactId>git</artifactId>
<version>3.8.1-SNAPSHOT</version>
<version>3.9.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>Jenkins Git plugin</name>
<description>Integrates Jenkins with GIT SCM</description>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin</url>
<inceptionYear>2007</inceptionYear>

<properties>
<jenkins.version>1.625.3</jenkins.version>
<jenkins.version>1.642.3</jenkins.version>
<java.level>7</java.level>
<no-test-jar>false</no-test-jar>
<concurrency>1C</concurrency>
<findbugs.failOnError>false</findbugs.failOnError>
<workflow.version>1.14.2</workflow.version>
<scm-api-plugin.version>2.2.0</scm-api-plugin.version>
</properties>

@@ -163,11 +162,22 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<version>${scm-api-plugin.version}</version>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
<version>${workflow.version}</version>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
@@ -273,7 +283,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>${workflow.version}</version>
<version>2.10</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
@@ -287,25 +297,37 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>${workflow.version}</version>
<version>2.32</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>${workflow.version}</version>
<version>2.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<version>${workflow.version}</version>
<version>2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<version>${workflow.version}</version>
<version>2.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-multibranch</artifactId>
<version>2.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps-global-lib</artifactId>
<version>2.8</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -14,6 +14,7 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -83,12 +84,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class AssemblaWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "AssemblaWeb";
}

@Override
public AssemblaWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public AssemblaWeb newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(AssemblaWeb.class, jsonObject);
}

@@ -10,6 +10,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -72,12 +73,14 @@ public URL getFileLink(GitChangeSet.Path path) throws IOException {

@Extension
public static class BitbucketWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "bitbucketweb";
}

@Override
public BitbucketWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public BitbucketWeb newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(BitbucketWeb.class, jsonObject);
}
}
@@ -11,6 +11,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -81,12 +82,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class CGITDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "cgit";
}

@Override
public CGit newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public CGit newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(CGit.class, jsonObject);
}
}
@@ -15,6 +15,7 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -68,12 +69,14 @@ public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {
@Extension
public static class FisheyeGitRepositoryBrowserDescriptor extends Descriptor<RepositoryBrowser<?>> {

@Nonnull
public String getDisplayName() {
return "FishEye";
}

@Override
public FisheyeGitRepositoryBrowser newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public FisheyeGitRepositoryBrowser newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(FisheyeGitRepositoryBrowser.class, jsonObject);
}

@@ -13,6 +13,7 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -66,12 +67,14 @@ private String encodeString(final String s) throws UnsupportedEncodingException
}
@Extension
public static class ViewGitWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gitblit";
}

@Override
public GitBlitRepositoryBrowser newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GitBlitRepositoryBrowser newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GitBlitRepositoryBrowser.class, jsonObject);
}

@@ -15,6 +15,7 @@
import java.io.IOException;
import java.net.URL;

import javax.annotation.Nonnull;
import javax.servlet.ServletException;

import org.kohsuke.stapler.QueryParameter;
@@ -123,12 +124,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class GitLabDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gitlab";
}

@Override
public GitLab newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GitLab newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GitLab.class, jsonObject);
}

@@ -18,6 +18,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -92,12 +93,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class GitListDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gitlist";
}

@Override
public GitList newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GitList newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GitList.class, jsonObject);
}
}
@@ -11,6 +11,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -83,12 +84,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class GitWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gitweb";
}

@Override
public GitWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GitWeb newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GitWeb.class, jsonObject);
}
}
@@ -11,6 +11,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.URL;

@@ -84,12 +85,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class GithubWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "githubweb";
}

@Override
public GithubWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GithubWeb newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GithubWeb.class, jsonObject);
}
}
@@ -11,6 +11,7 @@
import java.io.IOException;
import java.net.URL;

import javax.annotation.Nonnull;
import javax.servlet.ServletException;

import net.sf.json.JSONObject;
@@ -54,12 +55,14 @@ public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {

@Extension
public static class ViewGitWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gitiles";
}

@Override
public Gitiles newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public Gitiles newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(Gitiles.class, jsonObject);
}

@@ -10,6 +10,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -67,12 +68,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class GitoriousWebDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gitoriousweb";
}

@Override
public GitoriousWeb newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GitoriousWeb newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GitoriousWeb.class, jsonObject);
}
}
@@ -11,6 +11,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.net.URL;

@@ -90,12 +91,14 @@ public URL getFileLink(Path path) throws IOException {

@Extension
public static class GogsGitDescriptor extends Descriptor<RepositoryBrowser<?>> {
@Nonnull
public String getDisplayName() {
return "gogs";
}

@Override
public GogsGit newInstance(StaplerRequest req, JSONObject jsonObject) throws FormException {
public GogsGit newInstance(StaplerRequest req, @Nonnull JSONObject jsonObject) throws FormException {
assert req != null; //see inherited javadoc
return req.bindJSON(GogsGit.class, jsonObject);
}
}

0 comments on commit 927c829

Please sign in to comment.
You can’t perform that action at this time.