Skip to content
Permalink
Browse files

[JENKINS-38987 Follow-up] Expose the SCM API pronoun information

  • Loading branch information
stephenc committed Oct 14, 2016
1 parent 00e1e44 commit 3457d8357dfac7dc10c35312496c8d00210eb95e
14 pom.xml
@@ -69,7 +69,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>2.6</version>
<version>2.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -79,22 +79,22 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<version>1.3</version>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>branch-api</artifactId>
<version>1.11</version>
<version>1.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.12</version>
<version>5.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.3</version>
<version>2.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -140,7 +140,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.4</version>
<version>2.9-SNAPSHOT</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
@@ -218,7 +218,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.1.4</version>
<version>2.1.6</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -25,13 +25,16 @@
package org.jenkinsci.plugins.workflow.multibranch;

import hudson.Extension;
import hudson.model.AbstractItem;
import hudson.model.Item;
import hudson.model.JobPropertyDescriptor;
import hudson.security.ACL;
import hudson.security.Permission;
import hudson.util.AlternativeUiTextProvider;
import javax.annotation.Nonnull;
import jenkins.branch.Branch;
import org.acegisecurity.Authentication;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowJobProperty;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
@@ -82,4 +85,20 @@ synchronized void setBranch(@Nonnull Branch branch) {

}

@Extension
public static class AlternativeUiTextProviderImpl extends AlternativeUiTextProvider {

@Override
public <T> String getText(Message<T> text, T context) {
if (text == AbstractItem.PRONOUN && context instanceof WorkflowJob) {
WorkflowJob job = WorkflowJob.class.cast(context);
BranchJobProperty property = job.getProperty(BranchJobProperty.class);
if (property != null) {
return property.getBranch().getHead().getPronoun();
}
}
return null;
}
}

}
@@ -48,6 +48,7 @@
import jenkins.scm.api.SCMRevision;
import jenkins.scm.api.SCMRevisionAction;
import jenkins.scm.api.SCMSource;
import jenkins.scm.api.SCMSourceDescriptor;
import jenkins.scm.impl.subversion.SubversionSCMSource;
import static org.hamcrest.Matchers.*;

@@ -255,7 +256,7 @@ public WarySource(String id, String remote, String credentialsId, String include
return fetch(new SCMHead("master"), listener);
}
}
@Override public Descriptor<SCMSource> getDescriptor() {
@Override public SCMSourceDescriptor getDescriptor() {
return Jenkins.getInstance().getDescriptorByType(GitSCMSource.DescriptorImpl.class);
}
}

0 comments on commit 3457d83

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