hudson.scm
Class SubversionSCM

java.lang.Object
  extended by hudson.scm.SCM
      extended by hudson.scm.SubversionSCM
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.scm.SCM>, Serializable

public class SubversionSCM
extends hudson.scm.SCM
implements Serializable

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 Hudson. 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.FileCallables all need to be declared as static inner classes.

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Nested Class Summary
static class SubversionSCM.DescriptorImpl
           
static class SubversionSCM.External
          Information about svn:external
static 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
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
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
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(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(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions)
          Deprecated. as of 1.315
SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop)
          Deprecated. as of 1.324
SubversionSCM(List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages)
          Deprecated. as of 1.328
SubversionSCM(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)
           
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.286
SubversionSCM(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions)
          Deprecated. as of 1.311
SubversionSCM(String[] remoteLocations, String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop)
          Deprecated. as of 1.315
SubversionSCM(String svnUrl, String local)
          Convenience constructor, especially during testing.
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild<?,?> build, Map<String,String> env)
          Sets the SVN_REVISION_n and SVN_URL_n environment variables during the build.
 hudson.scm.SCMRevisionState calcRevisionsFromBuild(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.TaskListener listener)
           
 boolean checkout(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.BuildListener listener, File changelogFile)
           
protected  hudson.scm.PollingResult compareRemoteRevisionWith(hudson.model.AbstractProject<?,?> project, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.TaskListener listener, hudson.scm.SCMRevisionState _baseline)
           
 hudson.scm.ChangeLogParser createChangeLogParser()
           
static SvnClientManager createClientManager(hudson.model.AbstractProject context)
          Creates SVNClientManager for code running on the master.
static SvnClientManager createClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider)
          Creates SVNClientManager.
static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultSVNOptions()
          Creates the DefaultSVNOptions.
static org.tmatesoft.svn.core.auth.ISVNAuthenticationManager createSvnAuthenticationManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider)
           
static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(hudson.model.AbstractProject context)
          Deprecated. as of 2.0 Use createClientManager(AbstractProject)
static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider)
          Deprecated. as of 1.40 Use createClientManager(ISVNAuthenticationProvider)
 SVNLogFilter createSVNLogFilter()
           
static void enableSshDebug(Level level)
          Enables trace logging of Ganymed SSH library.
 SubversionRepositoryBrowser getBrowser()
           
 SubversionSCM.DescriptorImpl getDescriptor()
           
 String getExcludedCommitMessages()
           
 String[] getExcludedCommitMessagesNormalized()
           
 String getExcludedRegions()
           
 String[] getExcludedRegionsNormalized()
           
 String getExcludedRevprop()
           
 String getExcludedUsers()
           
 Set<String> getExcludedUsersNormalized()
           
 String getIncludedRegions()
           
 String[] getIncludedRegionsNormalized()
           
 SubversionSCM.ModuleLocation[] getLocations()
          list of all configured svn locations
 SubversionSCM.ModuleLocation[] getLocations(hudson.model.AbstractBuild<?,?> build)
          Deprecated. Use getLocations(EnvVars, AbstractBuild) for vars expansion to be performed on all env vars rather than just build parameters.
 SubversionSCM.ModuleLocation[] getLocations(hudson.EnvVars env, hudson.model.AbstractBuild<?,?> build)
          List of all configured svn locations, expanded according to all env vars or, if none defined, according to only build parameters values.
 hudson.FilePath getModuleRoot(hudson.FilePath workspace)
          Deprecated.  
 hudson.FilePath getModuleRoot(hudson.FilePath workspace, hudson.model.AbstractBuild build)
           
 hudson.FilePath[] getModuleRoots(hudson.FilePath workspace)
          Deprecated. 
 hudson.FilePath[] getModuleRoots(hudson.FilePath workspace, hudson.model.AbstractBuild build)
           
 String getModules()
          Deprecated. as of 1.91. Use getLocations() instead.
 SubversionSCM.ModuleLocation[] getProjectLocations(hudson.model.AbstractProject project)
          Get the list of every checked-out location.
static File getRevisionFile(hudson.model.AbstractBuild build)
          Gets the file that stores the revision.
 WorkspaceUpdater getWorkspaceUpdater()
           
static void init()
           
 boolean isFilterChangelog()
           
 boolean isIgnoreDirPropChanges()
           
 boolean repositoryLocationsNoLongerExist(hudson.model.AbstractBuild<?,?> build, hudson.model.TaskListener listener)
          Deprecated. 1.34
 boolean repositoryLocationsNoLongerExist(hudson.model.AbstractBuild<?,?> build, hudson.model.TaskListener listener, hudson.EnvVars env)
           
 boolean requiresWorkspaceForPolling()
          Polling can happen on the master and does not require a workspace.
 void setWorkspaceUpdater(WorkspaceUpdater workspaceUpdater)
           
 
Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, all, createEmptyChangeLog, getApi, getEffectiveBrowser, getType, nullify, poll, pollChanges, processWorkspaceBeforeDeletion, supportsPolling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static 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 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

@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)

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[] svnUrls,
                     String[] locals)
Convenience constructor, especially during testing.

Method Detail

getModules

public String getModules()
Deprecated. as of 1.91. Use getLocations() instead.


getLocations

@Exported
public SubversionSCM.ModuleLocation[] getLocations()
list of all configured svn locations

Since:
1.91

getWorkspaceUpdater

@Exported
public WorkspaceUpdater getWorkspaceUpdater()

setWorkspaceUpdater

public void setWorkspaceUpdater(WorkspaceUpdater workspaceUpdater)

getLocations

public SubversionSCM.ModuleLocation[] getLocations(hudson.model.AbstractBuild<?,?> build)
Deprecated. Use getLocations(EnvVars, AbstractBuild) for vars expansion to be performed on all env vars rather than just build parameters.

Since:
1.252

getLocations

public SubversionSCM.ModuleLocation[] getLocations(hudson.EnvVars env,
                                                   hudson.model.AbstractBuild<?,?> build)
List of all configured svn locations, expanded according to all env vars or, if none defined, according to only build parameters values.

Parameters:
env - If non-null, variable expansions are performed against these vars
build - If non-null (and if env is null), variable expansions are performed against the build parameters

getProjectLocations

public SubversionSCM.ModuleLocation[] getProjectLocations(hudson.model.AbstractProject project)
                                                   throws IOException
Get the list of every checked-out location. This differs from getLocations() 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 class hudson.scm.SCM

getExcludedRegions

@Exported
public String getExcludedRegions()

getExcludedRegionsNormalized

public String[] getExcludedRegionsNormalized()

getIncludedRegions

@Exported
public String getIncludedRegions()

getIncludedRegionsNormalized

public String[] getIncludedRegionsNormalized()

getExcludedUsers

@Exported
public String getExcludedUsers()

getExcludedUsersNormalized

public Set<String> getExcludedUsersNormalized()

getExcludedRevprop

@Exported
public String getExcludedRevprop()

getExcludedCommitMessages

@Exported
public String getExcludedCommitMessages()

getExcludedCommitMessagesNormalized

public String[] getExcludedCommitMessagesNormalized()

isIgnoreDirPropChanges

@Exported
public boolean isIgnoreDirPropChanges()

isFilterChangelog

@Exported
public boolean isFilterChangelog()

buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild<?,?> build,
                         Map<String,String> env)
Sets the SVN_REVISION_n and SVN_URL_n environment variables during the build.

Overrides:
buildEnvVars in class hudson.scm.SCM

requiresWorkspaceForPolling

public boolean requiresWorkspaceForPolling()
Polling can happen on the master and does not require a workspace.

Overrides:
requiresWorkspaceForPolling in class hudson.scm.SCM

checkout

public boolean checkout(hudson.model.AbstractBuild build,
                        hudson.Launcher launcher,
                        hudson.FilePath workspace,
                        hudson.model.BuildListener listener,
                        File changelogFile)
                 throws IOException,
                        InterruptedException
Specified by:
checkout in class hudson.scm.SCM
Throws:
IOException
InterruptedException

createSvnClientManager

public static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider)
Deprecated. as of 1.40 Use createClientManager(ISVNAuthenticationProvider)


createClientManager

public static SvnClientManager createClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider)
Creates SVNClientManager.

This method must be executed on the slave where svn operations are performed.

Parameters:
authProvider - The value obtained from SubversionSCM.DescriptorImpl.createAuthenticationProvider(AbstractProject). If the operation runs on slaves, (and properly remoted, if the svn operations run on slaves.)

createDefaultSVNOptions

public static org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions createDefaultSVNOptions()
Creates the DefaultSVNOptions.

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(hudson.model.AbstractProject context)
Deprecated. as of 2.0 Use createClientManager(AbstractProject)


createClientManager

public static SvnClientManager createClientManager(hudson.model.AbstractProject context)
Creates SVNClientManager for code running on the master.

CAUTION: this code only works when invoked on master. On slaves, use createSvnClientManager(ISVNAuthenticationProvider) and get ISVNAuthenticationProvider from the master via remoting.


getRevisionFile

public static File getRevisionFile(hudson.model.AbstractBuild build)
Gets the file that stores the revision.


calcRevisionsFromBuild

public hudson.scm.SCMRevisionState calcRevisionsFromBuild(hudson.model.AbstractBuild<?,?> build,
                                                          hudson.Launcher launcher,
                                                          hudson.model.TaskListener listener)
                                                   throws IOException,
                                                          InterruptedException
Specified by:
calcRevisionsFromBuild in class hudson.scm.SCM
Throws:
IOException
InterruptedException

compareRemoteRevisionWith

protected hudson.scm.PollingResult compareRemoteRevisionWith(hudson.model.AbstractProject<?,?> project,
                                                             hudson.Launcher launcher,
                                                             hudson.FilePath workspace,
                                                             hudson.model.TaskListener listener,
                                                             hudson.scm.SCMRevisionState _baseline)
                                                      throws IOException,
                                                             InterruptedException
Specified by:
compareRemoteRevisionWith in class hudson.scm.SCM
Throws:
IOException
InterruptedException

createSVNLogFilter

public SVNLogFilter createSVNLogFilter()

createChangeLogParser

public hudson.scm.ChangeLogParser createChangeLogParser()
Specified by:
createChangeLogParser in class hudson.scm.SCM

getDescriptor

public SubversionSCM.DescriptorImpl getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<hudson.scm.SCM>
Overrides:
getDescriptor in class hudson.scm.SCM

getModuleRoot

@Deprecated
public hudson.FilePath getModuleRoot(hudson.FilePath workspace)
Deprecated. 

Overrides:
getModuleRoot in class hudson.scm.SCM

getModuleRoot

public hudson.FilePath getModuleRoot(hudson.FilePath workspace,
                                     hudson.model.AbstractBuild build)
Overrides:
getModuleRoot in class hudson.scm.SCM

getModuleRoots

@Deprecated
public hudson.FilePath[] getModuleRoots(hudson.FilePath workspace)
Deprecated. 

Overrides:
getModuleRoots in class hudson.scm.SCM

getModuleRoots

public hudson.FilePath[] getModuleRoots(hudson.FilePath workspace,
                                        hudson.model.AbstractBuild build)
Overrides:
getModuleRoots in class hudson.scm.SCM

repositoryLocationsNoLongerExist

public boolean repositoryLocationsNoLongerExist(hudson.model.AbstractBuild<?,?> build,
                                                hudson.model.TaskListener listener)
Deprecated. 1.34


repositoryLocationsNoLongerExist

public boolean repositoryLocationsNoLongerExist(hudson.model.AbstractBuild<?,?> build,
                                                hudson.model.TaskListener listener,
                                                hudson.EnvVars env)
Since:
1.34

init

public static void init()

enableSshDebug

public static void enableSshDebug(Level level)
Enables trace logging of Ganymed SSH library.

Intended to be invoked from Groovy console.



Copyright © 2004-2013. All Rights Reserved.