Package org.jenkinsci.plugins.p4
Class PerforceScm
java.lang.Object
hudson.scm.SCM
org.jenkinsci.plugins.p4.PerforceScm
- All Implemented Interfaces:
ExtensionPoint,Describable<SCM>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe relationship of Descriptor and SCM (the describable) is akin to class and object.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final longFields inherited from class hudson.scm.SCM
PERMISSIONS, TAG -
Constructor Summary
ConstructorsConstructorDescriptionPerforceScm(String credential, Workspace workspace, List<Filter> filter, Populate populate, P4Browser browser) Create a constructor that takes non-transient fields, and add the annotation @DataBoundConstructor to it.PerforceScm(String credential, Workspace workspace, Populate populate) Internal constructor for functional tests.PerforceScm(AbstractP4ScmSource source, P4Path path, P4Ref revision) MultiBranch constructor for building jobs. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildEnvironment(Run<?, ?> run, Map<String, String> env) calcRevisionsFromBuild(Run<?, ?> run, FilePath buildWorkspace, Launcher launcher, TaskListener listener) Calculate the state of the workspace of the given build.voidcheckout(Run<?, ?> run, Launcher launcher, FilePath buildWorkspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) The checkout method is expected to check out modified files into the project workspace.compareRemoteRevisionWith(Job<?, ?> job, Launcher launcher, FilePath buildWorkspace, TaskListener listener, SCMRevisionState baseline) This method does the actual polling and returns a PollingResult.static PerforceScmconvertToPerforceScm(SCM scm) Helper function for converting an SCM object into a PerforceScm object when appropriate.The checkout method should, besides checking out the modified files, write a changelog.xml file that contains the changes for a certain build.static P4BrowserfindBrowser(String scmCredential) getKey()getScriptPath(Item item) booleanprocessWorkspaceBeforeDeletion(Job<?, ?> job, FilePath buildWorkspace, Node node) Called before a workspace is deleted on the given node, to provide SCM an opportunity to perform clean up.booleanThis method should return true if the SCM requires a workspace for polling.voidbooleanThis methods determines if the SCM plugin can be used for pollingMethods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, _for, all, buildEnvVars, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getEffectiveBrowser, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, guessBrowser, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion
-
Field Details
-
DEFAULT_FILE_LIMIT
public static final int DEFAULT_FILE_LIMIT- See Also:
-
DEFAULT_CHANGE_LIMIT
public static final int DEFAULT_CHANGE_LIMIT- See Also:
-
DEFAULT_HEAD_LIMIT
public static final long DEFAULT_HEAD_LIMIT- See Also:
-
-
Constructor Details
-
PerforceScm
@DataBoundConstructor public PerforceScm(String credential, Workspace workspace, List<Filter> filter, Populate populate, P4Browser browser) Create a constructor that takes non-transient fields, and add the annotation @DataBoundConstructor to it. Using the annotation helps the Stapler class to find which constructor that should be used when automatically copying values from a web form to a class.- Parameters:
credential- Credential IDworkspace- Workspace connection detailsfilter- Polling filterspopulate- Populate optionsbrowser- Browser options
-
PerforceScm
MultiBranch constructor for building jobs.- Parameters:
source- ScmSourcepath- Perforce project path and mappingsrevision- Perforce revision
-
PerforceScm
Internal constructor for functional tests.- Parameters:
credential- Credential IDworkspace- Workspace typepopulate- Populate options
-
-
Method Details
-
getCredential
-
getWorkspace
-
getFilter
-
getPopulate
-
getBrowser
- Overrides:
getBrowserin classSCM
-
getReview
-
setReview
-
convertToPerforceScm
Helper function for converting an SCM object into a PerforceScm object when appropriate.- Parameters:
scm- the SCM object- Returns:
- a PerforceScm instance or null
-
getKey
-
findBrowser
-
calcRevisionsFromBuild
public SCMRevisionState calcRevisionsFromBuild(Run<?, ?> run, FilePath buildWorkspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedExceptionCalculate the state of the workspace of the given build. The returned object is then fed into compareRemoteRevisionWith as the baseline SCMRevisionState to determine if the build is necessary, and is added to the build as an Action for later retrieval.- Overrides:
calcRevisionsFromBuildin classSCM- Throws:
IOExceptionInterruptedException
-
compareRemoteRevisionWith
public PollingResult compareRemoteRevisionWith(Job<?, ?> job, Launcher launcher, FilePath buildWorkspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedExceptionThis method does the actual polling and returns a PollingResult. The change attribute of the PollingResult the significance of the changes detected by this poll.- Overrides:
compareRemoteRevisionWithin classSCM- Throws:
IOExceptionInterruptedException
-
checkout
public void checkout(Run<?, ?> run, Launcher launcher, FilePath buildWorkspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedExceptionThe checkout method is expected to check out modified files into the project workspace. In Perforce terms a 'p4 sync' on the project's workspace. Authorisation- Overrides:
checkoutin classSCM- Throws:
IOExceptionInterruptedException
-
getScriptPath
-
buildEnvironment
- Overrides:
buildEnvironmentin classSCM
-
createChangeLogParser
The checkout method should, besides checking out the modified files, write a changelog.xml file that contains the changes for a certain build. The changelog.xml file is specific for each SCM implementation, and the createChangeLogParser returns a parser that can parse the file and return a ChangeLogSet.- Specified by:
createChangeLogParserin classSCM
-
processWorkspaceBeforeDeletion
public boolean processWorkspaceBeforeDeletion(Job<?, ?> job, FilePath buildWorkspace, Node node) throws IOException, InterruptedExceptionCalled before a workspace is deleted on the given node, to provide SCM an opportunity to perform clean up.- Overrides:
processWorkspaceBeforeDeletionin classSCM- Throws:
IOExceptionInterruptedException
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<SCM>- Overrides:
getDescriptorin classSCM
-
supportsPolling
public boolean supportsPolling()This methods determines if the SCM plugin can be used for polling- Overrides:
supportsPollingin classSCM
-
requiresWorkspaceForPolling
public boolean requiresWorkspaceForPolling()This method should return true if the SCM requires a workspace for polling. Perforce however can report submitted, pending and shelved changes without needing a workspace- Overrides:
requiresWorkspaceForPollingin classSCM
-