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>, java.io.Serializable

public class SubversionSCM
extends hudson.scm.SCM
implements java.io.Serializable

Subversion SCM.

Plugin Developer Notes

Plugins that interact with Subversion can use SubversionSCM.DescriptorImpl.createAuthenticationProvider() 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.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 int DEFAULT_TIMEOUT
          Network timeout in milliseconds.
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
SubversionSCM(java.util.List<SubversionSCM.ModuleLocation> locations, boolean useUpdate, SubversionRepositoryBrowser browser, java.lang.String excludedRegions)
           
SubversionSCM(java.lang.String svnUrl)
          Convenience constructor, especially during testing.
SubversionSCM(java.lang.String[] remoteLocations, java.lang.String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser)
          Deprecated. as of 1.286
SubversionSCM(java.lang.String[] remoteLocations, java.lang.String[] localLocations, boolean useUpdate, SubversionRepositoryBrowser browser, java.lang.String excludedRegions)
          Deprecated. as of 1.311
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild build, java.util.Map<java.lang.String,java.lang.String> env)
          Sets the SVN_REVISION environment variable during the build.
 boolean checkout(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.BuildListener listener, java.io.File changelogFile)
           
 hudson.scm.ChangeLogParser createChangeLogParser()
           
static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager()
          Creates SVNClientManager for code running on the master.
static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider authProvider)
          Creates SVNClientManager.
static void enableSshDebug(java.util.logging.Level level)
          Enables trace logging of Ganymed SSH library.
 SubversionRepositoryBrowser getBrowser()
           
 SubversionSCM.DescriptorImpl getDescriptor()
           
 java.lang.String getExcludedRegions()
           
 java.lang.String[] getExcludedRegionsNormalized()
           
 SubversionSCM.ModuleLocation[] getLocations()
          list of all configured svn locations
 SubversionSCM.ModuleLocation[] getLocations(hudson.model.AbstractBuild<?,?> build)
          list of all configured svn locations, expanded according to build parameters values;
 hudson.FilePath getModuleRoot(hudson.FilePath workspace)
           
 hudson.FilePath[] getModuleRoots(hudson.FilePath workspace)
           
 java.lang.String getModules()
          Deprecated. as of 1.91. Use getLocations() instead.
static java.io.File getRevisionFile(hudson.model.AbstractBuild build)
          Gets the file that stores the revision.
static void init()
           
 boolean isUseUpdate()
           
 boolean pollChanges(hudson.model.AbstractProject project, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.TaskListener listener)
           
 boolean repositoryLocationsExist(hudson.model.AbstractBuild<?,?> build, hudson.model.TaskListener listener)
           
 boolean requiresWorkspaceForPolling()
          Polling can happen on the master and does not require a workspace.
 
Methods inherited from class hudson.scm.SCM
_for, all, createEmptyChangeLog, getEffectiveBrowser, nullify, 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.

Constructor Detail

SubversionSCM

public SubversionSCM(java.lang.String[] remoteLocations,
                     java.lang.String[] localLocations,
                     boolean useUpdate,
                     SubversionRepositoryBrowser browser)
Deprecated. as of 1.286


SubversionSCM

public SubversionSCM(java.lang.String[] remoteLocations,
                     java.lang.String[] localLocations,
                     boolean useUpdate,
                     SubversionRepositoryBrowser browser,
                     java.lang.String excludedRegions)
Deprecated. as of 1.311


SubversionSCM

@DataBoundConstructor
public SubversionSCM(java.util.List<SubversionSCM.ModuleLocation> locations,
                                          boolean useUpdate,
                                          SubversionRepositoryBrowser browser,
                                          java.lang.String excludedRegions)

SubversionSCM

public SubversionSCM(java.lang.String svnUrl)
Convenience constructor, especially during testing.

Method Detail

getModules

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


getLocations

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

Since:
1.91

getLocations

public SubversionSCM.ModuleLocation[] getLocations(hudson.model.AbstractBuild<?,?> build)
list of all configured svn locations, expanded according to build parameters values;

Parameters:
build - If non-null, variable expansions are performed against the build parameters.
Since:
1.252

isUseUpdate

public boolean isUseUpdate()

getBrowser

public SubversionRepositoryBrowser getBrowser()
Overrides:
getBrowser in class hudson.scm.SCM

getExcludedRegions

public java.lang.String getExcludedRegions()

getExcludedRegionsNormalized

public java.lang.String[] getExcludedRegionsNormalized()

buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild build,
                         java.util.Map<java.lang.String,java.lang.String> env)
Sets the SVN_REVISION environment variable 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,
                        java.io.File changelogFile)
                 throws java.io.IOException,
                        java.lang.InterruptedException
Specified by:
checkout in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException

createSvnClientManager

public static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager(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(). If the operation runs on slaves, (and properly remoted, if the svn operations run on slaves.)

createSvnClientManager

public static org.tmatesoft.svn.core.wc.SVNClientManager createSvnClientManager()
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 java.io.File getRevisionFile(hudson.model.AbstractBuild build)
Gets the file that stores the revision.


pollChanges

public boolean pollChanges(hudson.model.AbstractProject project,
                           hudson.Launcher launcher,
                           hudson.FilePath workspace,
                           hudson.model.TaskListener listener)
                    throws java.io.IOException,
                           java.lang.InterruptedException
Specified by:
pollChanges in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException

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

public hudson.FilePath getModuleRoot(hudson.FilePath workspace)
Overrides:
getModuleRoot in class hudson.scm.SCM

getModuleRoots

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

repositoryLocationsExist

public boolean repositoryLocationsExist(hudson.model.AbstractBuild<?,?> build,
                                        hudson.model.TaskListener listener)
                                 throws org.tmatesoft.svn.core.SVNException
Throws:
org.tmatesoft.svn.core.SVNException

init

public static void init()

enableSshDebug

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

Intended to be invoked from Groovy console.



Copyright © 2009. All Rights Reserved.