Class SubversionSCM
- java.lang.Object
-
- hudson.scm.SCM
-
- hudson.scm.SubversionSCM
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<SCM>
public class SubversionSCM extends SCM
Subversion 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
), remotableFilePath.FileCallable
s all need to be declared as static inner classes.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubversionSCM.AdditionalCredentials
static class
SubversionSCM.DescriptorImpl
static class
SubversionSCM.External
Information about svn:externalstatic class
SubversionSCM.ModuleLocation
small structure to store local and remote (repository) location information of the repository.static class
SubversionSCM.SvnInfo
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_DIR
If set to non-null, read configuration from this directory instead of "~/.subversion".static int
DEFAULT_TIMEOUT
Network timeout in milliseconds.-
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
-
-
Constructor Summary
Constructors Constructor Description SubversionSCM(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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
buildEnvironment(Run<?,?> build, Map<String,String> env)
Sets theSVN_REVISION_n
andSVN_URL_n
environment variables during the build.SCMRevisionState
calcRevisionsFromBuild(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener)
void
checkout(Run build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline)
PollingResult
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
.ChangeLogParser
createChangeLogParser()
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.SVNLogFilter
createSVNLogFilter()
static SubversionSCM.DescriptorImpl
descriptor()
static void
enableSshDebug(Level level)
Deprecated.Logging all goes to JDK java.util.loggingList<SubversionSCM.AdditionalCredentials>
getAdditionalCredentials()
SubversionRepositoryBrowser
getBrowser()
SubversionSCM.DescriptorImpl
getDescriptor()
String
getExcludedCommitMessages()
String[]
getExcludedCommitMessagesNormalized()
String
getExcludedRegions()
String[]
getExcludedRegionsNormalized()
String
getExcludedRevprop()
String
getExcludedUsers()
Set<String>
getExcludedUsersNormalized()
String
getIncludedRegions()
String[]
getIncludedRegionsNormalized()
String
getKey()
SubversionSCM.ModuleLocation[]
getLocations()
list of all configured svn locationsSubversionSCM.ModuleLocation[]
getLocations(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.SubversionSCM.ModuleLocation[]
getLocations(AbstractBuild<?,?> build)
Deprecated.UsegetLocations(EnvVars, Run)
for vars expansion to be performed on all env vars rather than just build parameters.FilePath
getModuleRoot(FilePath workspace)
Deprecated.FilePath
getModuleRoot(FilePath workspace, AbstractBuild build)
FilePath[]
getModuleRoots(FilePath workspace)
Deprecated.FilePath[]
getModuleRoots(FilePath workspace, AbstractBuild build)
String
getModules()
Deprecated.as of 1.91.SubversionSCM.ModuleLocation[]
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.WorkspaceUpdater
getWorkspaceUpdater()
static void
init(int workspaceFormat)
boolean
isFilterChangelog()
boolean
isIgnoreDirPropChanges()
boolean
isQuietOperation()
static void
perJobCredentialsMigration()
boolean
repositoryLocationsNoLongerExist(AbstractBuild<?,?> build, TaskListener listener)
Deprecated.1.34boolean
repositoryLocationsNoLongerExist(Run<?,?> build, TaskListener listener, EnvVars env)
boolean
requiresWorkspaceForPolling()
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 Detail
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
Network 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
public static final String CONFIG_DIR
If set to non-null, read configuration from this directory instead of "~/.subversion".
-
-
Constructor Detail
-
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
public SubversionSCM(String svnUrl)
Convenience constructor, especially during testing.
-
SubversionSCM
public SubversionSCM(String svnUrl, String local)
Convenience constructor, especially during testing.
-
SubversionSCM
public SubversionSCM(String svnUrl, String credentialId, String local)
Convenience constructor, especially during testing.
-
SubversionSCM
public SubversionSCM(String svnUrl, String credentialId, String local, WorkspaceUpdater workspaceUpdater, SubversionRepositoryBrowser browser)
Convenience constructor, especially during testing.
-
SubversionSCM
public SubversionSCM(String[] svnUrls, String[] locals)
Convenience constructor, especially during testing.
-
-
Method Detail
-
getModules
public String getModules()
Deprecated.as of 1.91. UsegetLocations()
instead.
-
getLocations
@Exported public SubversionSCM.ModuleLocation[] getLocations()
list of all configured svn locations- Since:
- 1.91
-
getAdditionalCredentials
public List<SubversionSCM.AdditionalCredentials> getAdditionalCredentials()
-
getWorkspaceUpdater
@Exported public WorkspaceUpdater getWorkspaceUpdater()
-
setWorkspaceUpdater
public void setWorkspaceUpdater(WorkspaceUpdater workspaceUpdater)
-
getLocations
public SubversionSCM.ModuleLocation[] getLocations(AbstractBuild<?,?> build)
Deprecated.UsegetLocations(EnvVars, Run)
for vars expansion to be performed on all env vars rather than just build parameters.- Since:
- 1.252
-
getLocations
public SubversionSCM.ModuleLocation[] getLocations(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. 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
public SubversionSCM.ModuleLocation[] getProjectLocations(Job project) throws IOException
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
@Exported public SubversionRepositoryBrowser getBrowser()
- Overrides:
getBrowser
in classSCM
-
getExcludedRegions
@Exported public String getExcludedRegions()
-
getExcludedRegionsNormalized
public String[] getExcludedRegionsNormalized()
-
getIncludedRegions
@Exported public String getIncludedRegions()
-
getIncludedRegionsNormalized
public String[] getIncludedRegionsNormalized()
-
getExcludedUsers
@Exported public String getExcludedUsers()
-
getExcludedRevprop
@Exported public String getExcludedRevprop()
-
getExcludedCommitMessages
@Exported public String getExcludedCommitMessages()
-
getExcludedCommitMessagesNormalized
public String[] 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
public void buildEnvironment(Run<?,?> build, Map<String,String> env)
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
public static SvnClientManager createClientManager(AbstractProject context)
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
public static File getRevisionFile(Run build)
Gets the file that stores the revision.
-
getRevisionFile
@Deprecated public static File getRevisionFile(AbstractBuild build)
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
public SVNLogFilter createSVNLogFilter()
-
createChangeLogParser
public ChangeLogParser createChangeLogParser()
- Specified by:
createChangeLogParser
in classSCM
-
getDescriptor
public SubversionSCM.DescriptorImpl getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<SCM>
- Overrides:
getDescriptor
in classSCM
-
getModuleRoot
@Deprecated public FilePath getModuleRoot(FilePath workspace)
Deprecated.- Overrides:
getModuleRoot
in classSCM
-
getModuleRoot
public FilePath getModuleRoot(FilePath workspace, AbstractBuild build)
- Overrides:
getModuleRoot
in classSCM
-
getModuleRoots
@Deprecated public FilePath[] getModuleRoots(FilePath workspace)
Deprecated.- Overrides:
getModuleRoots
in classSCM
-
getModuleRoots
public FilePath[] getModuleRoots(FilePath workspace, AbstractBuild build)
- Overrides:
getModuleRoots
in classSCM
-
perJobCredentialsMigration
@Initializer(after=JOB_LOADED, before=COMPLETED) public static void perJobCredentialsMigration()
-
descriptor
@NonNull public static SubversionSCM.DescriptorImpl descriptor()
-
repositoryLocationsNoLongerExist
public boolean repositoryLocationsNoLongerExist(AbstractBuild<?,?> build, TaskListener listener)
Deprecated.1.34
-
repositoryLocationsNoLongerExist
public boolean repositoryLocationsNoLongerExist(Run<?,?> build, TaskListener listener, EnvVars env)
- Since:
- 1.34
-
init
public static void init(int workspaceFormat)
-
enableSshDebug
public static void enableSshDebug(Level level)
Deprecated.Logging all goes to JDK java.util.loggingEnables trace logging of Ganymed SSH library.Intended to be invoked from Groovy console.
-
-