Package jenkins.plugins.git
Class GitSCMSourceContext<C extends GitSCMSourceContext<C,R>,R extends GitSCMSourceRequest>
- java.lang.Object
-
- jenkins.scm.api.trait.SCMSourceContext<C,R>
-
- jenkins.plugins.git.GitSCMSourceContext<C,R>
-
- Type Parameters:
C- the type ofGitSCMSourceContextso that theSCMSourceContext.withTrait(SCMSourceTrait)etc methods can be chained easily by subclasses.R- the type ofGitSCMSourceRequestproduced bynewRequest(SCMSource, TaskListener).
public class GitSCMSourceContext<C extends GitSCMSourceContext<C,R>,R extends GitSCMSourceRequest> extends jenkins.scm.api.trait.SCMSourceContext<C,R>TheSCMSourceContextfor aAbstractGitSCMSource.- Since:
- 3.4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGitSCMSourceContext.RefNameMapping
-
Constructor Summary
Constructors Constructor Description GitSCMSourceContext(jenkins.scm.api.SCMSourceCriteria criteria, jenkins.scm.api.SCMHeadObserver observer)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.eclipse.jgit.transport.RefSpec>asRefSpecs()Converts the ref spec templates intoRefSpecinstances.Collection<GitSCMSourceContext.RefNameMapping>getRefNameMappings()StringgitTool()Returns the name of theGitToolto use ornullto use the default.booleanignoreOnPushNotifications()Returnstrueif push notifications should be ignored.RnewRequest(jenkins.scm.api.SCMSource source, TaskListener listener)booleanpruneRefs()Returnstrueif theGitSCMSourceRequestneeds to be prune aware.CpruneRefs(boolean include)Adds a requirement for git ref pruning to anyGitSCMSourceRequestfor this context.List<String>refSpecs()Returns the list of ref specs to use.StringremoteName()Returns the name to give the remote.booleanwantBranches()Returnstrueif theGitSCMSourceRequestwill need information about branches.CwantBranches(boolean include)Adds a requirement for branch details to anyGitSCMSourceRequestfor this context.CwantOtherRef(GitSCMSourceContext.RefNameMapping other)Adds a requirement for details of additional refs to anyGitSCMSourceRequestfor this context.booleanwantOtherRefs()Returnstrueif theGitSCMSourceRequestwill need information about other refs.booleanwantTags()Returnstrueif theGitSCMSourceRequestwill need information about tags.CwantTags(boolean include)Adds a requirement for tag details to anyGitSCMSourceRequestfor this context.CwithGitTool(String gitTool)Configures theToolInstallation.getName()to use.CwithIgnoreOnPushNotifications(boolean ignoreOnPushNotifications)Configures whether push notifications should be ignored.CwithoutRefSpecs()Clears the specified ref specs.CwithRefSpec(String refSpec)Adds the specified ref spec.CwithRefSpecs(List<String> refSpecs)Adds the specified ref specs.CwithRemoteName(String remoteName)Configures the remote name to use for the git repository.
-
-
-
Method Detail
-
wantBranches
public final boolean wantBranches()
Returnstrueif theGitSCMSourceRequestwill need information about branches.- Returns:
trueif theGitSCMSourceRequestwill need information about branches.
-
wantTags
public final boolean wantTags()
Returnstrueif theGitSCMSourceRequestwill need information about tags.- Returns:
trueif theGitSCMSourceRequestwill need information about tags.
-
pruneRefs
public final boolean pruneRefs()
Returnstrueif theGitSCMSourceRequestneeds to be prune aware.- Returns:
trueif theGitSCMSourceRequestneeds to be prune aware.
-
wantOtherRefs
public final boolean wantOtherRefs()
Returnstrueif theGitSCMSourceRequestwill need information about other refs.- Returns:
trueif theGitSCMSourceRequestwill need information about other refs.
-
getRefNameMappings
@NonNull public Collection<GitSCMSourceContext.RefNameMapping> getRefNameMappings()
-
gitTool
@CheckForNull public final String gitTool()
Returns the name of theGitToolto use ornullto use the default.- Returns:
- the name of the
GitToolto use ornullto use the default.
-
ignoreOnPushNotifications
public final boolean ignoreOnPushNotifications()
Returnstrueif push notifications should be ignored.- Returns:
trueif push notifications should be ignored.
-
refSpecs
@NonNull public final List<String> refSpecs()
Returns the list of ref specs to use.- Returns:
- the list of ref specs to use.
-
remoteName
@NonNull public final String remoteName()
Returns the name to give the remote.- Returns:
- the name to give the remote.
-
wantBranches
@NonNull public C wantBranches(boolean include)
Adds a requirement for branch details to anyGitSCMSourceRequestfor this context.- Parameters:
include-trueto add the requirement orfalseto leave the requirement as is (makes simpler with method chaining)- Returns:
thisfor method chaining.
-
wantTags
@NonNull public C wantTags(boolean include)
Adds a requirement for tag details to anyGitSCMSourceRequestfor this context.- Parameters:
include-trueto add the requirement orfalseto leave the requirement as is (makes simpler with method chaining)- Returns:
thisfor method chaining.
-
pruneRefs
@NonNull public C pruneRefs(boolean include)
Adds a requirement for git ref pruning to anyGitSCMSourceRequestfor this context.- Parameters:
include-trueto add the requirement orfalseto leave the requirement as is (makes simpler with method chaining)- Returns:
thisfor method chaining.
-
wantOtherRef
@NonNull public C wantOtherRef(GitSCMSourceContext.RefNameMapping other)
Adds a requirement for details of additional refs to anyGitSCMSourceRequestfor this context.- Parameters:
other- The specification for that other ref- Returns:
thisfor method chaining.
-
withGitTool
@NonNull public final C withGitTool(String gitTool)
Configures theToolInstallation.getName()to use.- Parameters:
gitTool- theToolInstallation.getName()ornullto use the system default.- Returns:
thisfor method chaining.
-
withIgnoreOnPushNotifications
@NonNull public final C withIgnoreOnPushNotifications(boolean ignoreOnPushNotifications)
Configures whether push notifications should be ignored.- Parameters:
ignoreOnPushNotifications-trueto ignore push notifications.- Returns:
thisfor method chaining.
-
withRefSpec
@NonNull public final C withRefSpec(@NonNull String refSpec)
Adds the specified ref spec. If no ref specs were previously defined then the supplied ref spec will replaceAbstractGitSCMSource.REF_SPEC_DEFAULT. The ref spec is expected to be processed for substitution ofAbstractGitSCMSource.REF_SPEC_REMOTE_NAME_PLACEHOLDER_STRbyAbstractGitSCMSource.getRemote()before use.- Parameters:
refSpec- the ref spec template to add.- Returns:
thisfor method chaining.- See Also:
withoutRefSpecs()
-
withRefSpecs
@NonNull public final C withRefSpecs(List<String> refSpecs)
Adds the specified ref specs. If no ref specs were previously defined then the supplied ref specs will replaceAbstractGitSCMSource.REF_SPEC_DEFAULT. The ref spec is expected to be processed for substitution ofAbstractGitSCMSource.REF_SPEC_REMOTE_NAME_PLACEHOLDER_STRbyAbstractGitSCMSource.getRemote()before use.- Parameters:
refSpecs- the ref spec templates to add.- Returns:
thisfor method chaining.- See Also:
withoutRefSpecs()
-
withoutRefSpecs
@NonNull public final C withoutRefSpecs()
Clears the specified ref specs. If no ref specs are subsequently defined thenAbstractGitSCMSource.REF_SPEC_DEFAULTwill be used as the ref spec template.- Returns:
thisfor method chaining.
-
withRemoteName
@NonNull public final C withRemoteName(String remoteName)
Configures the remote name to use for the git repository.- Parameters:
remoteName- the remote name to use for the git repository (nullor the empty string are equivalent to passingAbstractGitSCMSource.DEFAULT_REMOTE_NAME).- Returns:
thisfor method chaining.
-
asRefSpecs
@NonNull public final List<org.eclipse.jgit.transport.RefSpec> asRefSpecs()
Converts the ref spec templates intoRefSpecinstances.- Returns:
- the list of
RefSpecinstances.
-
newRequest
@NonNull public R newRequest(@NonNull jenkins.scm.api.SCMSource source, TaskListener listener)
- Specified by:
newRequestin classjenkins.scm.api.trait.SCMSourceContext<C extends GitSCMSourceContext<C,R>,R extends GitSCMSourceRequest>
-
-