Skip to content
Permalink
Browse files

[JENKINS-38987 Follow-up] Provide implementations of getPronoun() for…

… the SCMHead/Source/Navigator
  • Loading branch information...
stephenc committed Oct 14, 2016
1 parent ac752a2 commit c0557dd3fa8b53e0ff52d315424cebd8fdfd61d9
@@ -34,7 +34,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<version>1.2</version>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
@@ -56,7 +56,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>1.22</version>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>com.coravy.hudson.plugins.github</groupId>
@@ -0,0 +1,25 @@
package org.jenkinsci.plugins.github_branch_source;

import edu.umd.cs.findbugs.annotations.NonNull;
import jenkins.scm.api.SCMHead;

/**
* Head corresponding to a branch.
* @since FIXME
*/
public class BranchSCMHead extends SCMHead {
/**
* {@inheritDoc}
*/
public BranchSCMHead(@NonNull String name) {
super(name);
}

/**
* {@inheritDoc}
*/
@Override
public String getPronoun() {
return Messages.BranchSCMHead_Pronoun();
}
}
@@ -34,7 +34,6 @@
import hudson.model.TaskListener;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
@@ -338,7 +337,15 @@ private void add(TaskListener listener, SCMSourceObserver observer, GHRepository
public static final boolean defaultBuildForkPRHead = GitHubSCMSource.DescriptorImpl.defaultBuildForkPRHead;

@Inject private GitHubSCMSource.DescriptorImpl delegate;


/**
* {@inheritDoc}
*/
@Override
public String getPronoun() {
return Messages.GitHubSCMNavigator_Pronoun();
}

@Override public String getDisplayName() {
return Messages.GitHubSCMNavigator_DisplayName();
}
@@ -212,6 +212,12 @@ public String getRepository() {
return repository;
}

/** {@inheritDoc} */
@Override
public String getPronoun() {
return Messages.GitHubSCMSource_Pronoun();
}

@Override
protected List<RefSpec> getRefSpecs() {
return new ArrayList<>(Arrays.asList(new RefSpec("+refs/heads/*:refs/remotes/origin/*"),
@@ -498,7 +504,7 @@ private void doRetrieve(SCMHeadObserver observer, TaskListener listener, GHRepos
continue;
}
}
SCMHead head = new SCMHead(branchName);
SCMHead head = new BranchSCMHead(branchName);
SCMRevision hash = new SCMRevisionImpl(head, entry.getValue().getSHA1());
observer.observe(head, hash);
if (!observer.isObserving()) {
@@ -740,7 +746,7 @@ public static void addAliases() {

@Override
public String getDisplayName() {
return "GitHub";
return Messages.GitHubSCMSource_DisplayName();
}

@Restricted(NoExternalUse.class)
@@ -49,6 +49,14 @@
this.trusted = trusted;
}

/**
* {@inheritDoc}
*/
@Override
public String getPronoun() {
return Messages.PullRequestSCMHead_Pronoun();
}

public int getNumber() {
if (metadata != null) {
return Integer.parseInt(metadata.getId());
@@ -1,3 +1,5 @@
BranchSCMHead.Pronoun=Branch

GitHubBuildStatusNotification.CommitStatus.Good=This commit looks good
GitHubBuildStatusNotification.CommitStatus.Unstable=This commit has test failures
GitHubBuildStatusNotification.CommitStatus.Failure=This commit cannot be built
@@ -8,5 +10,10 @@ GitHubBuildStatusNotification.CommitStatusSet=GitHub has been notified of this c

GitHubSCMNavigator.DisplayName=GitHub Organization
GitHubSCMNavigator.Description=Scans a GitHub organization (or user account) for all repositories matching some defined markers.
GitHubSCMNavigator.Pronoun=Organization

GitHubSCMSource.DisplayName=GitHub
GitHubSCMSource.Pronoun=Repository
GitHubSCMSource.did_you_mean_to_use_to_match_all_branches=Did you mean to use * to match all branches?

PullRequestSCMHead.Pronoun=Pull Request

0 comments on commit c0557dd

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