Class NullSCM
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCM>
SCM
.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncalcRevisionsFromBuild
(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) Calculates theSCMRevisionState
that represents the state of the workspace of the given build.void
checkout
(Run<?, ?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) Obtains a fresh workspace of the module(s) into the specified directory of the specified machine.compareRemoteRevisionWith
(Job<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) Compares the current state of the remote repository against the given baselineSCMRevisionState
.The returned object will be used to parsechangelog.xml
.Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, _for, all, buildEnvironment, buildEnvVars, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getBrowser, getDescriptor, getEffectiveBrowser, getKey, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, guessBrowser, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
-
Constructor Details
-
NullSCM
@DataBoundConstructor public NullSCM()
-
-
Method Details
-
calcRevisionsFromBuild
public SCMRevisionState calcRevisionsFromBuild(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedExceptionDescription copied from class:SCM
Calculates theSCMRevisionState
that represents the state of the workspace of the given build.The returned object is then fed into the
SCM.compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)
method as the baselineSCMRevisionState
to determine if the build is necessary.This method is called after source code is checked out for the given build (that is, after
SCM.checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState)
has finished successfully.)The obtained object is added to the build as an
Action
for later retrieval. As an optimization,SCM
implementation can choose to computeSCMRevisionState
and add it as an action during check out, in which case this method will not called.- Overrides:
calcRevisionsFromBuild
in classSCM
- Parameters:
build
- The calculatedSCMRevisionState
is for the files checked out in this build. IfSCM.requiresWorkspaceForPolling()
returns true, Hudson makes sure that the workspace of this build is available and accessible by the callee.workspace
- the location of the checkout; normally not null, since this will normally be called immediately after checkout, though could be null if data is being loaded from a very old version of Jenkins and the SCM declares that it does not require a workspace for pollinglauncher
- Abstraction of the machine where the polling will take place. Nullness matches that ofworkspace
.listener
- Logs during the polling should be sent here.- Throws:
InterruptedException
- interruption is usually caused by the user aborting the computation. this exception should be simply propagated all the way up.IOException
-
compareRemoteRevisionWith
public PollingResult compareRemoteRevisionWith(Job<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedExceptionDescription copied from class:SCM
Compares the current state of the remote repository against the given baselineSCMRevisionState
.Conceptually, the act of polling is to take two states of the repository and to compare them to see if there's any difference. In practice, however, comparing two arbitrary repository states is an expensive operation, so in this abstraction, we chose to mix (1) the act of building up a repository state and (2) the act of comparing it with the earlier state, so that SCM implementations can implement this more easily.
Multiple invocations of this method may happen over time to make sure that the remote repository is "quiet" before Hudson schedules a new build.
- Overrides:
compareRemoteRevisionWith
in classSCM
- Parameters:
project
- The project to check for updateslauncher
- Abstraction of the machine where the polling will take place. If SCM declares that the polling doesn't require a workspace, this parameter is null.workspace
- The workspace directory that contains baseline files. If SCM declares that the polling doesn't require a workspace, this parameter is null.listener
- Logs during the polling should be sent here.baseline
- The baseline of the comparison. This object is the return value from earlierSCM.compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)
orSCM.calcRevisionsFromBuild(AbstractBuild, Launcher, TaskListener)
.- Returns:
- This method returns multiple values that are bundled together into the
PollingResult
value type.PollingResult.baseline
should be the value of the baseline parameter,PollingResult.remote
is the current state of the remote repository (this object only needs to be understandable to the future invocations of this method), andPollingResult.change
that indicates the degree of changes found during the comparison. - Throws:
InterruptedException
- interruption is usually caused by the user aborting the computation. this exception should be simply propagated all the way up.IOException
-
checkout
public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedExceptionDescription copied from class:SCM
Obtains a fresh workspace of the module(s) into the specified directory of the specified machine.The "update" operation can be performed instead of a fresh checkout if feasible.
This operation should also capture the information necessary to tag the workspace later.
- Overrides:
checkout
in classSCM
launcher
- Abstracts away the machine that the files will be checked out.workspace
- a directory to check out the source code. May contain left-over from the previous build.changelogFile
- Upon a successful return, this file should capture the changelog. When there's no change, this file should contain an empty entry. SeeSCM.createEmptyChangeLog(File, TaskListener, String)
. May be null, in which case no changelog was requested.baseline
- version from the previous build to use for changelog creation, if requested and available- Throws:
AbortException
- in case of a routine failureInterruptedException
- interruption is usually caused by the user aborting the build. this exception will cause the build to be aborted.IOException
-
createChangeLogParser
Description copied from class:SCM
The returned object will be used to parsechangelog.xml
.- Specified by:
createChangeLogParser
in classSCM
-