Skip to content
Permalink
Browse files

[JENKINS-43507] Fix trait drop-down list population

  • Loading branch information...
stephenc committed Jun 24, 2017
1 parent d632ecb commit b1bc5a40f01db1d23a3ece9ab8dd5ba3bf1e92b2
Showing with 16 additions and 3 deletions.
  1. +16 −3 src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java
@@ -53,8 +53,12 @@
import jenkins.scm.api.trait.SCMSourceRequest;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.api.trait.SCMSourceTraitDescriptor;
import jenkins.scm.api.trait.SCMTraitDescriptor;
import jenkins.scm.impl.form.NamedArrayList;
import jenkins.scm.impl.trait.Discovery;
import jenkins.scm.impl.trait.RegexSCMHeadFilterTrait;
import jenkins.scm.impl.trait.RegexSCMSourceFilterTrait;
import jenkins.scm.impl.trait.Selection;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
@@ -389,11 +393,20 @@ private boolean hasAccessToCredentialsMetadata(SCMSourceOwner owner){
return RepositoryBrowsers.filter(HgBrowser.class);
}

public List<SCMSourceTraitDescriptor> getTraitDescriptors() {
return SCMSourceTrait._for(this, MercurialSCMSourceContext.class, MercurialSCMBuilder.class);
public List<NamedArrayList<? extends SCMTraitDescriptor<?>>> getTraitsDescriptorLists() {
List<SCMSourceTraitDescriptor> all =
SCMSourceTrait._for(this, MercurialSCMSourceContext.class, MercurialSCMBuilder.class);
List<NamedArrayList<? extends SCMTraitDescriptor<?>>> result = new ArrayList<>();
NamedArrayList.select(all, "Within repository",
NamedArrayList.anyOf(
NamedArrayList.withAnnotation(Discovery.class),
NamedArrayList.withAnnotation(Selection.class)
),true, result);
NamedArrayList.select(all, "Additional", null, true, result);
return result;
}

public List<SCMSourceTrait> getTraitDefaults() {
public List<SCMSourceTrait> getTraitsDefaults() {
return Collections.emptyList();
}

0 comments on commit b1bc5a4

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