Skip to content
Permalink
Browse files

[JENKINS-43507] Pick up new releases

  • Loading branch information...
stephenc committed Jul 5, 2017
1 parent fe99a79 commit d7c3ece2553cf0494a56c766f62a6c9f340bbe4c
@@ -30,7 +30,7 @@
<concurrency>1C</concurrency>
<findbugs.failOnError>false</findbugs.failOnError>
<workflow.version>1.14.2</workflow.version>
<scm-api-plugin.version>2.2.0-alpha-1</scm-api-plugin.version>
<scm-api-plugin.version>2.2.0-beta-1</scm-api-plugin.version>
</properties>

<build>
@@ -96,6 +96,7 @@
import jenkins.scm.api.metadata.PrimaryInstanceMetadataAction;
import jenkins.scm.api.trait.SCMSourceRequest;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.api.trait.SCMTrait;
import jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait;
import jenkins.scm.impl.trait.WildcardSCMSourceFilterTrait;
import org.apache.commons.lang.StringUtils;
@@ -185,12 +186,8 @@ public AbstractGitSCMSource(String id) {
@Restricted(NoExternalUse.class)
@RestrictedSince("3.4.0")
public String getIncludes() {
for (SCMSourceTrait trait: getTraits()) {
if (trait instanceof WildcardSCMHeadFilterTrait) {
return ((WildcardSCMHeadFilterTrait) trait).getIncludes();
}
}
return "*";
WildcardSCMHeadFilterTrait trait = SCMTrait.find(getTraits(), WildcardSCMHeadFilterTrait.class);
return trait != null ? trait.getIncludes() : "*";
}

/**
@@ -201,12 +198,8 @@ public String getIncludes() {
@Restricted(NoExternalUse.class)
@RestrictedSince("3.4.0")
public String getExcludes() {
for (SCMSourceTrait trait : getTraits()) {
if (trait instanceof WildcardSCMHeadFilterTrait) {
return ((WildcardSCMHeadFilterTrait) trait).getExcludes();
}
}
return "";
WildcardSCMHeadFilterTrait trait = SCMTrait.find(getTraits(), WildcardSCMHeadFilterTrait.class);
return trait != null ? trait.getExcludes() : "";
}

/**
@@ -220,13 +213,8 @@ public String getExcludes() {
@Restricted(NoExternalUse.class)
@RestrictedSince("3.4.0")
public GitRepositoryBrowser getBrowser() {
for (SCMSourceTrait trait : getTraits()) {
if (trait instanceof GitBrowserSCMSourceTrait) {
return ((GitBrowserSCMSourceTrait) trait).getBrowser();
}
}
// Always return null by default
return null;
GitBrowserSCMSourceTrait trait = SCMTrait.find(getTraits(), GitBrowserSCMSourceTrait.class);
return trait != null ? trait.getBrowser() : null;
}

/**
@@ -240,13 +228,8 @@ public GitRepositoryBrowser getBrowser() {
@Restricted(NoExternalUse.class)
@RestrictedSince("3.4.0")
public String getGitTool() {
for (SCMSourceTrait trait : getTraits()) {
if (trait instanceof GitToolSCMSourceTrait) {
return ((GitToolSCMSourceTrait) trait).getGitTool();
}
}
// Always return null by default
return null;
GitToolSCMSourceTrait trait = SCMTrait.find(getTraits(), GitToolSCMSourceTrait.class);
return trait != null ? trait.getGitTool() : null;
}

/**
@@ -289,12 +272,8 @@ public String getGitTool() {
@Restricted(NoExternalUse.class)
@RestrictedSince("3.4.0")
public String getRemoteName() {
for (SCMSourceTrait t : getTraits()) {
if (t instanceof RemoteNameSCMSourceTrait) {
return ((RemoteNameSCMSourceTrait) t).getRemoteName();
}
}
return DEFAULT_REMOTE_NAME;
RemoteNameSCMSourceTrait trait = SCMTrait.find(getTraits(), RemoteNameSCMSourceTrait.class);
return trait != null ? trait.getRemoteName() : DEFAULT_REMOTE_NAME;
}

/**
@@ -83,6 +83,7 @@
import jenkins.scm.api.trait.SCMHeadPrefilter;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.api.trait.SCMSourceTraitDescriptor;
import jenkins.scm.api.trait.SCMTrait;
import jenkins.scm.impl.form.NamedArrayList;
import jenkins.scm.impl.trait.Discovery;
import jenkins.scm.impl.trait.Selection;
@@ -162,7 +163,7 @@ public void setCredentialsId(@CheckForNull String credentialsId) {

@DataBoundSetter
public void setTraits(List<SCMSourceTrait> traits) {
this.traits = traits == null ? new ArrayList<SCMSourceTrait>() : new ArrayList<SCMSourceTrait>(traits);
this.traits = SCMTrait.asSetList(traits);
}

@Deprecated
@@ -172,7 +173,7 @@ public GitSCMSource(String id, String remote, String credentialsId, String remot
super(id);
this.remote = remote;
this.credentialsId = credentialsId;
this.traits = new ArrayList<>();
List<SCMSourceTrait> traits = new ArrayList<>();
this.traits.add(new BranchDiscoveryTrait());
if (!DEFAULT_INCLUDES.equals(includes) || !DEFAULT_EXCLUDES.equals(excludes)) {
traits.add(new WildcardSCMHeadFilterTrait(includes, excludes));
@@ -187,6 +188,7 @@ public GitSCMSource(String id, String remote, String credentialsId, String remot
if (trait != null) {
traits.add(trait);
}
setTraits(traits);
}

@Deprecated
@@ -198,7 +200,7 @@ public GitSCMSource(String id, String remote, String credentialsId, String inclu

private Object readResolve() throws ObjectStreamException {
if (traits == null) {
traits = new ArrayList<>();
List<SCMSourceTrait> traits = new ArrayList<>();
traits.add(new BranchDiscoveryTrait());
if ((includes != null && !DEFAULT_INCLUDES.equals(includes))
|| (excludes != null && !DEFAULT_EXCLUDES.equals(excludes))) {
@@ -244,6 +246,7 @@ private Object readResolve() throws ObjectStreamException {
if (trait != null) {
traits.add(trait);
}
setTraits(traits);
}
return this;
}
@@ -279,19 +282,15 @@ private RefSpecsSCMSourceTrait asRefSpecsSCMSourceTrait(String rawRefSpecs, Stri
@Restricted(DoNotUse.class)
@RestrictedSince("3.4.0")
public boolean isIgnoreOnPushNotifications() {
for (SCMSourceTrait trait : traits) {
if (trait instanceof IgnoreOnPushNotificationTrait) {
return true;
}
}
return false;
return SCMTrait.find(traits, IgnoreOnPushNotificationTrait.class) != null;
}


// For Stapler only
@Restricted(DoNotUse.class)
@DataBoundSetter
public void setBrowser(GitRepositoryBrowser browser) {
List<SCMSourceTrait> traits = new ArrayList<>(this.traits);
for (Iterator<SCMSourceTrait> iterator = traits.iterator(); iterator.hasNext(); ) {
if (iterator.next() instanceof GitBrowserSCMSourceTrait) {
iterator.remove();
@@ -300,12 +299,14 @@ public void setBrowser(GitRepositoryBrowser browser) {
if (browser != null) {
traits.add(new GitBrowserSCMSourceTrait(browser));
}
setTraits(traits);
}

// For Stapler only
@Restricted(DoNotUse.class)
@DataBoundSetter
public void setGitTool(String gitTool) {
List<SCMSourceTrait> traits = new ArrayList<>(this.traits);
gitTool = Util.fixEmptyAndTrim(gitTool);
for (Iterator<SCMSourceTrait> iterator = traits.iterator(); iterator.hasNext(); ) {
if (iterator.next() instanceof GitToolSCMSourceTrait) {
@@ -315,13 +316,15 @@ public void setGitTool(String gitTool) {
if (gitTool != null) {
traits.add(new GitToolSCMSourceTrait(gitTool));
}
setTraits(traits);
}

// For Stapler only
@Restricted(DoNotUse.class)
@DataBoundSetter
@Deprecated
public void setExtensions(@CheckForNull List<GitSCMExtension> extensions) {
List<SCMSourceTrait> traits = new ArrayList<>(this.traits);
for (Iterator<SCMSourceTrait> iterator = traits.iterator(); iterator.hasNext(); ) {
if (iterator.next() instanceof GitSCMExtensionTrait) {
iterator.remove();
@@ -349,6 +352,7 @@ public void setExtensions(@CheckForNull List<GitSCMExtension> extensions) {
+ "make sense for a GitSCMSource)", extension.getClass().getName());
}
}
setTraits(traits);
}

@Override

0 comments on commit d7c3ece

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