jetbrains.buildServer.vcs
Class VcsSupport

java.lang.Object
  extended by jetbrains.buildServer.vcs.VcsSupport

public abstract class VcsSupport
extends java.lang.Object

This class should be implemented in order to support any version control system in TeamCity server. Each particular implementation can implement any of interfaces:

AgentSideCheckoutAbility marker indicates that the support allows to check sources out on agent.

VcsPersonalSupport produces possibility to match full version control file path into relative one.

RootMerger allows to merge several vcs roots into one if it is possible.


Constructor Summary
VcsSupport()
           
 
Method Summary
abstract  void buildPatch(jetbrains.buildServer.vcs.VcsRoot root, java.lang.String fromVersion, java.lang.String toVersion, PatchBuilder builder, jetbrains.buildServer.vcs.CheckoutRules checkoutRules)
          Called to retreive detailed info on modification between two given revisions.
abstract  java.util.List<jetbrains.buildServer.vcs.ModificationData> collectBuildChanges(jetbrains.buildServer.vcs.VcsRoot root, java.lang.String fromVersion, java.lang.String currentVersion, jetbrains.buildServer.vcs.CheckoutRules checkoutRules)
          Returns list of the changes between two revisions given.
abstract  java.lang.String describeVcsRoot(jetbrains.buildServer.vcs.VcsRoot vcsRoot)
          Returns presentable text describing specified vcs root, for example: svn: http://www.somehost.com/project/
abstract  byte[] getContent(java.lang.String filePath, jetbrains.buildServer.vcs.VcsRoot versionedRoot, java.lang.String version)
          Get binary content of the single file in modification set.
abstract  byte[] getContent(VcsModification vcsModification, jetbrains.buildServer.vcs.VcsChangeInfo change, jetbrains.buildServer.vcs.VcsChangeInfo.ContentType contentType, jetbrains.buildServer.vcs.VcsRoot vcsRoot)
          Get binary content of the single file in modification set.
abstract  java.lang.String getCurrentVersion(jetbrains.buildServer.vcs.VcsRoot root)
          Returns version mark version control is currenly in (like last committed change list number for Perforce, or current date for CVS).
abstract  java.util.Map<java.lang.String,java.lang.String> getDefaultVcsProperties()
          Returns default VCS property values.
abstract  java.lang.String getDisplayName()
          Returns name to be shown in the UI.
 LabelingSupport getLabelingSupport()
          Return LabelingSupport implementation to enabel vcs labeling
abstract  java.lang.String getName()
          Unquie VCS identifier among other installed plugins.
 VcsPersonalSupport getPersonalSupport()
          Return VcsPersonalSupport implementation if vcs has to provide remote run functionality
abstract  PropertiesProcessor getVcsPropertiesProcessor()
          Validator for the version control settings as displayed on configuration page for the VCS root.
abstract  java.lang.String getVcsSettingsJspFilePath()
          Version control settings editor page.
abstract  java.util.Comparator<java.lang.String> getVersionComparator()
          Returns comparator which allows to sort modifications by their version.
abstract  java.lang.String getVersionDisplayName(java.lang.String version, jetbrains.buildServer.vcs.VcsRoot root)
          Returns readable presentation of version (this format should be the same as DisplayVersion of VcsModification)
 boolean ignoreServerCachesFor(jetbrains.buildServer.vcs.VcsRoot root)
          Return true to disable caching of patches built with fromVersion = null for specified VCS root.
abstract  boolean isTestConnectionSupported()
          Returns true if test connection is supported
 boolean sourcesUpdatePossibleIfChangesNotFound(jetbrains.buildServer.vcs.VcsRoot root)
          Must return true if source files in the build checkout directory can be updated even if no changes were detected between some versions.
abstract  java.lang.String testConnection(jetbrains.buildServer.vcs.VcsRoot vcsRoot)
          Called to test connection to the given VCS root.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VcsSupport

public VcsSupport()
Method Detail

collectBuildChanges

public abstract java.util.List<jetbrains.buildServer.vcs.ModificationData> collectBuildChanges(jetbrains.buildServer.vcs.VcsRoot root,
                                                                                               @NotNull
                                                                                               java.lang.String fromVersion,
                                                                                               @NotNull
                                                                                               java.lang.String currentVersion,
                                                                                               jetbrains.buildServer.vcs.CheckoutRules checkoutRules)
                                                                                        throws jetbrains.buildServer.vcs.VcsException
Returns list of the changes between two revisions given. Implement CurrentVersionIsExpensiveVcsSupport if collectBuildChanges(final VcsRoot root, final String fromVersion, final CheckoutRules checkoutRules) should be invoked instead of this method.

Parameters:
root - current settings.
fromVersion - collect changes from this version.
currentVersion - collect changes up to this version.
checkoutRules - checkout rules built on union of all checkout rules of all configurations connected to the root. Include rules have 'from' part the same as 'to' one so you can don't map file pathes according to include rules.
Returns:
list of changes between specified versions.
Throws:
VcsException - throw this exception if some problem occurred while collecting chanegs or changes cannot be collected because of invalid configuration. Localized message will be shown on the web page for the corresponding project
See Also:
service method, which allows you to collect changes for each root include rule.

buildPatch

public abstract void buildPatch(jetbrains.buildServer.vcs.VcsRoot root,
                                @Nullable
                                java.lang.String fromVersion,
                                @NotNull
                                java.lang.String toVersion,
                                PatchBuilder builder,
                                jetbrains.buildServer.vcs.CheckoutRules checkoutRules)
                         throws java.io.IOException,
                                jetbrains.buildServer.vcs.VcsException
Called to retreive detailed info on modification between two given revisions. Results are to be fed to the builder passed.

Parameters:
root - current settings
fromVersion - collect files, changed since this version. If it is null, collect all project files to the moment on 'toVersion' parameter.
toVersion - collect files, changed between 'fromVersion' and this version
builder - call methods of this interface in order to build patch.
checkoutRules - checkout rules for sources to be gotten.
Throws:
java.io.IOException - rethrow this exception, if it will be thrown from some PatchBuilder method
VcsException - throw this exception if some problem occurred while collecting chanegs or changes cannot be collected because of invalid configuration. Localized message will be shown on the web page for the corresponding project.
See Also:
service class prevents you from manual mapping of file pathes.

getContent

@NotNull
public abstract byte[] getContent(VcsModification vcsModification,
                                          jetbrains.buildServer.vcs.VcsChangeInfo change,
                                          jetbrains.buildServer.vcs.VcsChangeInfo.ContentType contentType,
                                          jetbrains.buildServer.vcs.VcsRoot vcsRoot)
                           throws jetbrains.buildServer.vcs.VcsException
Get binary content of the single file in modification set.

Parameters:
vcsModification - - modification set.
change - - specified change of file.
contentType - - specified what content should be return - before modicication or after it.
vcsRoot - - current settings.
Returns:
- content of the file specified by VcsChange, by version, specified in 'contentType' parameter.
Throws:
VcsException - - throw this exception if some problem occurred while collecting chanegs or changes cannot be collected because of invalid configuration.

getContent

@NotNull
public abstract byte[] getContent(java.lang.String filePath,
                                          jetbrains.buildServer.vcs.VcsRoot versionedRoot,
                                          java.lang.String version)
                           throws jetbrains.buildServer.vcs.VcsException
Get binary content of the single file in modification set.

Parameters:
filePath - - relative file path regarding to the project root, "checkout root" from vcs root should not be included
versionedRoot - - current settings.
version - - version of the repository.
Returns:
- specified file content, corresponding to the repository version specified in 'version' parameter.
Throws:
VcsException - - throw this exception if some problem occurred while collecting changes or changes cannot be collected because of invalid configuration, or if file, corresponding to specified path cannot be found.

getName

public abstract java.lang.String getName()
Unquie VCS identifier among other installed plugins.

Returns:
- unique version control name

getDisplayName

public abstract java.lang.String getDisplayName()
Returns name to be shown in the UI.

Returns:
name to be shown to user

getVcsPropertiesProcessor

public abstract PropertiesProcessor getVcsPropertiesProcessor()
Validator for the version control settings as displayed on configuration page for the VCS root.

Returns:
- properties validator
See Also:
AbstractVcsPropertiesProcessor

getVcsSettingsJspFilePath

public abstract java.lang.String getVcsSettingsJspFilePath()
Version control settings editor page.

Returns:
path to configuration jsp page

getCurrentVersion

@NotNull
public abstract java.lang.String getCurrentVersion(jetbrains.buildServer.vcs.VcsRoot root)
                                            throws jetbrains.buildServer.vcs.VcsException
Returns version mark version control is currenly in (like last committed change list number for Perforce, or current date for CVS).

Parameters:
root - - current configuration
Returns:
- current version of repository. This version has to have the same meaning as a VcsModification version
Throws:
VcsException - throw this exception if some problem occurred while collecting chanegs or changes cannot be collected because of invalid configuration. Localized message will be shown on the web page for the corresponding project.

describeVcsRoot

public abstract java.lang.String describeVcsRoot(jetbrains.buildServer.vcs.VcsRoot vcsRoot)
Returns presentable text describing specified vcs root, for example: svn: http://www.somehost.com/project/

Parameters:
vcsRoot - vcs root to describe
Returns:
vcs root description

isTestConnectionSupported

public abstract boolean isTestConnectionSupported()
Returns true if test connection is supported

Returns:
if test connection supported

testConnection

public abstract java.lang.String testConnection(jetbrains.buildServer.vcs.VcsRoot vcsRoot)
                                         throws jetbrains.buildServer.vcs.VcsException
Called to test connection to the given VCS root.

Parameters:
vcsRoot - root to be tested
Returns:
current connection description or null if no additional information shall be displayed to the user in case of successful connection.
Throws:
VcsException - - throw this exception if connection failed

getDefaultVcsProperties

@Nullable
public abstract java.util.Map<java.lang.String,java.lang.String> getDefaultVcsProperties()
Returns default VCS property values.

Returns:
default configuration values

getVersionDisplayName

public abstract java.lang.String getVersionDisplayName(java.lang.String version,
                                                       jetbrains.buildServer.vcs.VcsRoot root)
                                                throws jetbrains.buildServer.vcs.VcsException
Returns readable presentation of version (this format should be the same as DisplayVersion of VcsModification)

Parameters:
version - version in internal format
root - root to get version display name for.
Returns:
display format of repository version
Throws:
VcsException - some problem with version control server occurred.

getVersionComparator

@NotNull
public abstract java.util.Comparator<java.lang.String> getVersionComparator()
Returns comparator which allows to sort modifications by their version. Latest modification in the sorted collection should be latest (in the collection) modification made in the repository.

Returns:
comparator of two repository versions, both versions were got from VcsModification.getVersion, specific for this support.
See Also:
Service comparator for dates, service comparator for integer versions, service comparator for string versions

getPersonalSupport

public VcsPersonalSupport getPersonalSupport()
Return VcsPersonalSupport implementation if vcs has to provide remote run functionality

Returns:
implementation if vcs has to provide remote run functionality. null if this version control does not support remote run.

getLabelingSupport

public LabelingSupport getLabelingSupport()
Return LabelingSupport implementation to enabel vcs labeling

Returns:
vcs labeling support implementation. null if this version control does not support labeling.

ignoreServerCachesFor

public boolean ignoreServerCachesFor(@NotNull
                                     jetbrains.buildServer.vcs.VcsRoot root)
Return true to disable caching of patches built with fromVersion = null for specified VCS root.

Parameters:
root - VCS root
Returns:
see above

sourcesUpdatePossibleIfChangesNotFound

public boolean sourcesUpdatePossibleIfChangesNotFound(@NotNull
                                                      jetbrains.buildServer.vcs.VcsRoot root)
Must return true if source files in the build checkout directory can be updated even if no changes were detected between some versions. This is possible for example if VCS support plugin can't detect changes when a tag/label is moved.

Parameters:
root - VCS root
Returns:
see above