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 ofGitSCMSourceContext
so that theSCMSourceContext.withTrait(SCMSourceTrait)
etc methods can be chained easily by subclasses.R
- the type ofGitSCMSourceRequest
produced bynewRequest(SCMSource, TaskListener)
.
public class GitSCMSourceContext<C extends GitSCMSourceContext<C,R>,R extends GitSCMSourceRequest>
extends jenkins.scm.api.trait.SCMSourceContext<C,R>
The
SCMSourceContext
for a AbstractGitSCMSource
.- Since:
- 3.4.0
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionGitSCMSourceContext
(jenkins.scm.api.SCMSourceCriteria criteria, jenkins.scm.api.SCMHeadObserver observer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal List<org.eclipse.jgit.transport.RefSpec>
Converts the ref spec templates intoRefSpec
instances.final String
gitTool()
Returns the name of theGitTool
to use ornull
to use the default.final boolean
Returnstrue
if push notifications should be ignored.newRequest
(jenkins.scm.api.SCMSource source, TaskListener listener) final boolean
Returnstrue
if theGitSCMSourceRequest
needs to be prune aware.pruneRefs
(boolean include) Adds a requirement for git ref pruning to anyGitSCMSourceRequest
for this context.refSpecs()
Returns the list of ref specs to use.final String
Returns the name to give the remote.final boolean
Returnstrue
if theGitSCMSourceRequest
will need information about branches.wantBranches
(boolean include) Adds a requirement for branch details to anyGitSCMSourceRequest
for this context.Adds a requirement for details of additional refs to anyGitSCMSourceRequest
for this context.final boolean
Returnstrue
if theGitSCMSourceRequest
will need information about other refs.final boolean
wantTags()
Returnstrue
if theGitSCMSourceRequest
will need information about tags.wantTags
(boolean include) Adds a requirement for tag details to anyGitSCMSourceRequest
for this context.final C
withGitTool
(String gitTool) Configures theToolInstallation.getName()
to use.final C
withIgnoreOnPushNotifications
(boolean ignoreOnPushNotifications) Configures whether push notifications should be ignored.final C
Clears the specified ref specs.final C
withRefSpec
(String refSpec) Adds the specified ref spec.final C
withRefSpecs
(List<String> refSpecs) Adds the specified ref specs.final C
withRemoteName
(String remoteName) Configures the remote name to use for the git repository.Methods inherited from class jenkins.scm.api.trait.SCMSourceContext
authorities, criteria, filters, observer, prefilters, withAuthority, withCriteria, withFilter, withPrefilter, withTrait, withTraits, withTraits
-
Constructor Details
-
GitSCMSourceContext
public GitSCMSourceContext(@CheckForNull jenkins.scm.api.SCMSourceCriteria criteria, @NonNull jenkins.scm.api.SCMHeadObserver observer) Constructor.- Parameters:
criteria
- (optional) criteria.observer
- theSCMHeadObserver
.
-
-
Method Details
-
wantBranches
public final boolean wantBranches()Returnstrue
if theGitSCMSourceRequest
will need information about branches.- Returns:
true
if theGitSCMSourceRequest
will need information about branches.
-
wantTags
public final boolean wantTags()Returnstrue
if theGitSCMSourceRequest
will need information about tags.- Returns:
true
if theGitSCMSourceRequest
will need information about tags.
-
pruneRefs
public final boolean pruneRefs()Returnstrue
if theGitSCMSourceRequest
needs to be prune aware.- Returns:
true
if theGitSCMSourceRequest
needs to be prune aware.
-
wantOtherRefs
public final boolean wantOtherRefs()Returnstrue
if theGitSCMSourceRequest
will need information about other refs.- Returns:
true
if theGitSCMSourceRequest
will need information about other refs.
-
getRefNameMappings
-
gitTool
Returns the name of theGitTool
to use ornull
to use the default.- Returns:
- the name of the
GitTool
to use ornull
to use the default.
-
ignoreOnPushNotifications
public final boolean ignoreOnPushNotifications()Returnstrue
if push notifications should be ignored.- Returns:
true
if push notifications should be ignored.
-
refSpecs
Returns the list of ref specs to use.- Returns:
- the list of ref specs to use.
-
remoteName
Returns the name to give the remote.- Returns:
- the name to give the remote.
-
wantBranches
Adds a requirement for branch details to anyGitSCMSourceRequest
for this context.- Parameters:
include
-true
to add the requirement orfalse
to leave the requirement as is (makes simpler with method chaining)- Returns:
this
for method chaining.
-
wantTags
Adds a requirement for tag details to anyGitSCMSourceRequest
for this context.- Parameters:
include
-true
to add the requirement orfalse
to leave the requirement as is (makes simpler with method chaining)- Returns:
this
for method chaining.
-
pruneRefs
Adds a requirement for git ref pruning to anyGitSCMSourceRequest
for this context.- Parameters:
include
-true
to add the requirement orfalse
to leave the requirement as is (makes simpler with method chaining)- Returns:
this
for method chaining.
-
wantOtherRef
Adds a requirement for details of additional refs to anyGitSCMSourceRequest
for this context.- Parameters:
other
- The specification for that other ref- Returns:
this
for method chaining.
-
withGitTool
Configures theToolInstallation.getName()
to use.- Parameters:
gitTool
- theToolInstallation.getName()
ornull
to use the system default.- Returns:
this
for method chaining.
-
withIgnoreOnPushNotifications
Configures whether push notifications should be ignored.- Parameters:
ignoreOnPushNotifications
-true
to ignore push notifications.- Returns:
this
for method chaining.
-
withRefSpec
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_STR
byAbstractGitSCMSource.getRemote()
before use.- Parameters:
refSpec
- the ref spec template to add.- Returns:
this
for method chaining.- See Also:
-
withRefSpecs
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_STR
byAbstractGitSCMSource.getRemote()
before use.- Parameters:
refSpecs
- the ref spec templates to add.- Returns:
this
for method chaining.- See Also:
-
withoutRefSpecs
Clears the specified ref specs. If no ref specs are subsequently defined thenAbstractGitSCMSource.REF_SPEC_DEFAULT
will be used as the ref spec template.- Returns:
this
for method chaining.
-
withRemoteName
Configures the remote name to use for the git repository.- Parameters:
remoteName
- the remote name to use for the git repository (null
or the empty string are equivalent to passingAbstractGitSCMSource.DEFAULT_REMOTE_NAME
).- Returns:
this
for method chaining.
-
asRefSpecs
Converts the ref spec templates intoRefSpec
instances.- Returns:
- the list of
RefSpec
instances.
-
newRequest
- Specified by:
newRequest
in classjenkins.scm.api.trait.SCMSourceContext<C extends GitSCMSourceContext<C,
R>, R extends GitSCMSourceRequest>
-