Class SubversionSCM
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCM>
Plugin Developer Notes
Plugins that interact with Subversion can use SubversionSCM.DescriptorImpl.createAuthenticationProvider(AbstractProject)
so that it can use the credentials (username, password, etc.) that the user entered for Jenkins.
See the javadoc of this method for the precautions you need to take if you run Subversion operations
remotely on slaves.
Implementation Notes
Because this instance refers to some other classes that are not necessarily
Java serializable (like browser
), remotable FilePath.FileCallable
s all
need to be declared as static inner classes.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static final class
Information about svn:externalstatic final class
small structure to store local and remote (repository) location information of the repository.static final class
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
If set to non-null, read configuration from this directory instead of "~/.subversion".static final int
Network timeout in milliseconds.Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
-
Constructor Summary
ConstructorDescriptionSubversionSCM
(String svnUrl) Convenience constructor, especially during testing.SubversionSCM
(String[] svnUrls, String[] locals) Convenience constructor, especially during testing.SubversionSCM
(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser) Deprecated.as of 1.286SubversionSCM
(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions) Deprecated.as of 1.311SubversionSCM
(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop) Deprecated.as of 1.315SubversionSCM
(String[] svnUrls, String[] credentialIds, String[] locals) Convenience constructor, especially during testing.SubversionSCM
(String svnUrl, String local) Convenience constructor, especially during testing.SubversionSCM
(String svnUrl, String credentialId, String local) Convenience constructor, especially during testing.SubversionSCM
(String svnUrl, String credentialId, String local, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser) Convenience constructor, especially during testing.SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages) Deprecated.as of 1.xxxSubversionSCM
(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) Deprecated.as of 1.23SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions) Deprecated.as of 1.315SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop) Deprecated.as of 1.324SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages) Deprecated.as of 1.328SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) Deprecated.as of ...SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions, boolean ignoreDirPropChanges) Deprecated.SubversionSCM
(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions, boolean ignoreDirPropChanges, boolean filterChangelog, List<SubversionSCM.AdditionalCredentials> additionalCredentials) Deprecated.by quietOperationSubversionSCM
(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions, boolean ignoreDirPropChanges, boolean filterChangelog, List<SubversionSCM.AdditionalCredentials> additionalCredentials, boolean quietOperation) -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildEnvironment
(Run<?, ?> build, Map<String, String> env) Sets theSVN_REVISION_n
andSVN_URL_n
environment variables during the build.calcRevisionsFromBuild
(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) void
checkout
(Run build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) compareRemoteRevisionWith
(Job<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState _baseline) org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider
createAuthenticationProvider
(Job<?, ?> inContextOf, SubversionSCM.ModuleLocation location) Deprecated.org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider
createAuthenticationProvider
(Job<?, ?> inContextOf, SubversionSCM.ModuleLocation location, TaskListener listener) CreatesISVNAuthenticationProvider
.static SvnClientManager
createClientManager
(AbstractProject context) CreatesSVNClientManager
for code running on the master.static SvnClientManager
createClientManager
(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider) Deprecated.static SvnClientManager
createClientManager
(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider, boolean storeAuthToDisk, int workspaceFormat) CreatesSVNClientManager
.static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions
createDefaultSVNOptions
(boolean storeAuthToDisk) Creates theDefaultSVNOptions
.static org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
createSvnAuthenticationManager
(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider) static org.tmatesoft.svn.core.wc.SVNClientManager
createSvnClientManager
(AbstractProject context) Deprecated.as of 2.0 UsecreateClientManager(AbstractProject)
static org.tmatesoft.svn.core.wc.SVNClientManager
createSvnClientManager
(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider) Deprecated.static SubversionSCM.DescriptorImpl
static void
enableSshDebug
(Level level) Deprecated.Logging all goes to JDK java.util.loggingString[]
String[]
String[]
getKey()
list of all configured svn locationsgetLocations
(EnvVars env, Run<?, ?> build) List of all configured svn locations, expanded according to all env vars or, if none defined, according to only build parameters values.getLocations
(AbstractBuild<?, ?> build) Deprecated.UsegetLocations(EnvVars, Run)
for vars expansion to be performed on all env vars rather than just build parameters.getModuleRoot
(FilePath workspace) Deprecated.getModuleRoot
(FilePath workspace, AbstractBuild build) FilePath[]
getModuleRoots
(FilePath workspace) Deprecated.FilePath[]
getModuleRoots
(FilePath workspace, AbstractBuild build) Deprecated.as of 1.91.getProjectLocations
(Job project) Get the list of every checked-out location.static File
getRevisionFile
(AbstractBuild build) Deprecated.usegetRevisionFile(hudson.model.Run)
instead.static File
getRevisionFile
(Run build) Gets the file that stores the revision.static void
init
(int workspaceFormat) boolean
boolean
boolean
static void
boolean
repositoryLocationsNoLongerExist
(AbstractBuild<?, ?> build, TaskListener listener) Deprecated.1.34boolean
repositoryLocationsNoLongerExist
(Run<?, ?> build, TaskListener listener, EnvVars env) boolean
Polling can happen on the master and does not require a workspace.void
setQuietOperation
(boolean quietOperation) Convenience method solely for testing.void
setWorkspaceUpdater
(WorkspaceUpdater workspaceUpdater) Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, _for, all, buildEnvVars, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getEffectiveBrowser, getType, guessBrowser, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion, processWorkspaceBeforeDeletion, supportsPolling
-
Field Details
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTNetwork timeout in milliseconds. The main point of this is to prevent infinite hang, so it should be a rather long value to avoid accidental time out problem. -
CONFIG_DIR
If set to non-null, read configuration from this directory instead of "~/.subversion".
-
-
Constructor Details
-
SubversionSCM
public SubversionSCM(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser) Deprecated.as of 1.286 -
SubversionSCM
public SubversionSCM(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions) Deprecated.as of 1.311 -
SubversionSCM
public SubversionSCM(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop) Deprecated.as of 1.315 -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions) Deprecated.as of 1.315 -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop) Deprecated.as of 1.324 -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages) Deprecated.as of 1.328 -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages) Deprecated.as of 1.xxx -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) Deprecated.as of 1.23 -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) Deprecated.as of ... -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions, boolean ignoreDirPropChanges) Deprecated. -
SubversionSCM
public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions, boolean ignoreDirPropChanges, boolean filterChangelog, List<SubversionSCM.AdditionalCredentials> additionalCredentials) Deprecated.by quietOperation -
SubversionSCM
@DataBoundConstructor public SubversionSCM(List<SubversionSCM.ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions, boolean ignoreDirPropChanges, boolean filterChangelog, List<SubversionSCM.AdditionalCredentials> additionalCredentials, boolean quietOperation) -
SubversionSCM
Convenience constructor, especially during testing. -
SubversionSCM
Convenience constructor, especially during testing. -
SubversionSCM
Convenience constructor, especially during testing. -
SubversionSCM
public SubversionSCM(String svnUrl, String credentialId, String local, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser) Convenience constructor, especially during testing. -
SubversionSCM
Convenience constructor, especially during testing. -
SubversionSCM
Convenience constructor, especially during testing.
-
-
Method Details
-
getModules
Deprecated.as of 1.91. UsegetLocations()
instead. -
getLocations
list of all configured svn locations- Since:
- 1.91
-
getKey
-
getAdditionalCredentials
-
getWorkspaceUpdater
-
setWorkspaceUpdater
-
getLocations
Deprecated.UsegetLocations(EnvVars, Run)
for vars expansion to be performed on all env vars rather than just build parameters.- Since:
- 1.252
-
getLocations
List of all configured svn locations, expanded according to all env vars or, if none defined, according to only build parameters values. Both may be defined, in which case the variables are combined.- Parameters:
env
- If non-null, variable expansions are performed against these varsbuild
- If non-null, variable expansions are performed against the build parameters
-
getProjectLocations
Get the list of every checked-out location. This differs fromgetLocations()
which returns only the configured locations whereas this method returns the configured locations + any svn:externals locations.- Throws:
IOException
-
getBrowser
- Overrides:
getBrowser
in classSCM
-
getExcludedRegions
-
getExcludedRegionsNormalized
-
getIncludedRegions
-
getIncludedRegionsNormalized
-
getExcludedUsers
-
getExcludedUsersNormalized
-
getExcludedRevprop
-
getExcludedCommitMessages
-
getExcludedCommitMessagesNormalized
-
isIgnoreDirPropChanges
@Exported public boolean isIgnoreDirPropChanges() -
isFilterChangelog
@Exported public boolean isFilterChangelog() -
isQuietOperation
@Exported public boolean isQuietOperation() -
setQuietOperation
public void setQuietOperation(boolean quietOperation) Convenience method solely for testing. -
buildEnvironment
Sets theSVN_REVISION_n
andSVN_URL_n
environment variables during the build.- Overrides:
buildEnvironment
in classSCM
-
requiresWorkspaceForPolling
public boolean requiresWorkspaceForPolling()Polling can happen on the master and does not require a workspace.- Overrides:
requiresWorkspaceForPolling
in classSCM
-
checkout
public void checkout(Run build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException - Overrides:
checkout
in classSCM
- Throws:
IOException
InterruptedException
-
createSvnClientManager
public static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider) Deprecated. -
createClientManager
public static SvnClientManager createClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider, boolean storeAuthToDisk, int workspaceFormat) CreatesSVNClientManager
.This method must be executed on the slave where svn operations are performed.
- Parameters:
authProvider
- The value obtained fromcreateAuthenticationProvider(Job,ModuleLocation, TaskListener)
. If the operation runs on slaves, (and properly remoted, if the svn operations run on slaves.)
-
createClientManager
@Deprecated public static SvnClientManager createClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider) Deprecated. -
createDefaultSVNOptions
public static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultSVNOptions(boolean storeAuthToDisk) Creates theDefaultSVNOptions
.- Returns:
- the
DefaultSVNOptions
.
-
createSvnAuthenticationManager
public static org.tmatesoft.svn.core.auth.ISVNAuthenticationManager createSvnAuthenticationManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider) -
createSvnClientManager
public static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(AbstractProject context) Deprecated.as of 2.0 UsecreateClientManager(AbstractProject)
-
createClientManager
CreatesSVNClientManager
for code running on the master.CAUTION: this code only works when invoked on master. On slaves, use
createSvnClientManager(ISVNAuthenticationProvider)
and getISVNAuthenticationProvider
from the master via remoting. -
createAuthenticationProvider
public org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider createAuthenticationProvider(Job<?, ?> inContextOf, SubversionSCM.ModuleLocation location, TaskListener listener) CreatesISVNAuthenticationProvider
. This method must be invoked on the master, but the returned object is remotable.Therefore, to access
ISVNAuthenticationProvider
, you need to call this method on the master, then pass the object to the slave side, then callcreateSvnClientManager(ISVNAuthenticationProvider)
on the slave. -
createAuthenticationProvider
@Deprecated public org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider createAuthenticationProvider(Job<?, ?> inContextOf, SubversionSCM.ModuleLocation location) Deprecated. -
getRevisionFile
Gets the file that stores the revision. -
getRevisionFile
Deprecated.usegetRevisionFile(hudson.model.Run)
instead. Gets the file that stores the revision. -
calcRevisionsFromBuild
public SCMRevisionState calcRevisionsFromBuild(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException- Overrides:
calcRevisionsFromBuild
in classSCM
- Throws:
IOException
InterruptedException
-
compareRemoteRevisionWith
public PollingResult compareRemoteRevisionWith(Job<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState _baseline) throws IOException, InterruptedException- Overrides:
compareRemoteRevisionWith
in classSCM
- Throws:
IOException
InterruptedException
-
createSVNLogFilter
-
createChangeLogParser
- Specified by:
createChangeLogParser
in classSCM
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<SCM>
- Overrides:
getDescriptor
in classSCM
-
getModuleRoot
Deprecated.- Overrides:
getModuleRoot
in classSCM
-
getModuleRoot
- Overrides:
getModuleRoot
in classSCM
-
getModuleRoots
Deprecated.- Overrides:
getModuleRoots
in classSCM
-
getModuleRoots
- Overrides:
getModuleRoots
in classSCM
-
perJobCredentialsMigration
-
descriptor
-
repositoryLocationsNoLongerExist
Deprecated.1.34 -
repositoryLocationsNoLongerExist
- Since:
- 1.34
-
init
public static void init(int workspaceFormat) -
enableSshDebug
Deprecated.Logging all goes to JDK java.util.loggingEnables trace logging of Ganymed SSH library.Intended to be invoked from Groovy console.
-