-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into filter-drafts-trait
- Loading branch information
Showing
8 changed files
with
150 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/jenkinsci/plugins/github_branch_source/ExcludeForkedRepositoriesTrait.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jenkinsci.plugins.github_branch_source; | ||
|
||
import hudson.Extension; | ||
import javax.annotation.Nonnull; | ||
import jenkins.scm.api.trait.SCMNavigatorContext; | ||
import jenkins.scm.api.trait.SCMNavigatorTrait; | ||
import jenkins.scm.api.trait.SCMNavigatorTraitDescriptor; | ||
import jenkins.scm.impl.trait.Selection; | ||
import org.jenkinsci.Symbol; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* A {@link Selection} trait that will restrict the discovery of repositories that have been forked. | ||
*/ | ||
public class ExcludeForkedRepositoriesTrait extends SCMNavigatorTrait { | ||
|
||
/** Constructor for stapler. */ | ||
@DataBoundConstructor | ||
public ExcludeForkedRepositoriesTrait() {} | ||
|
||
/** {@inheritDoc} */ | ||
@Override | ||
protected void decorateContext(SCMNavigatorContext<?, ?> context) { | ||
super.decorateContext(context); | ||
GitHubSCMNavigatorContext ctx = (GitHubSCMNavigatorContext) context; | ||
ctx.setExcludeForkedRepositories(true); | ||
} | ||
|
||
/** Exclude forked repositories filter */ | ||
@Symbol("gitHubExcludeForkedRepositories") | ||
@Extension | ||
@Selection | ||
public static class DescriptorImpl extends SCMNavigatorTraitDescriptor { | ||
|
||
@Override | ||
public Class<? extends SCMNavigatorContext> getContextClass() { | ||
return GitHubSCMNavigatorContext.class; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getDisplayName() { | ||
return Messages.ExcludeForkedRepositoriesTrait_displayName(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters