jetbrains.buildServer.vcs
Interface VcsManager

All Superinterfaces:
VcsRootsUpdate

public interface VcsManager
extends VcsRootsUpdate

A basic starting point for various VCS - related operatoins, including, but not limited to:

Author:
Kir

Method Summary
 SVcsModification findModificationById(long changeId, boolean isPersonal)
          Find and return VCS modification by its id and isPersonal flag.
 SVcsRoot findRootById(long id)
          returns vcs root with specified id
 SVcsRoot findRootByIdAndVersion(long rootId, long versionId)
          Find a VCS root with given id and given version
 SVcsRoot findRootByName(java.lang.String name)
          Returns VCS root having the specified name
 java.util.List<SVcsRoot> findUnusedVcsRootsByScope(VcsRootScope scope)
          Returns list of VCS roots having specified scope and having no usages in build configurations.
 VcsSupport findVcsByName(java.lang.String name)
          Try to find and return VcsSupport
 VcsPersonalSupport findVcsPersonalSupportByName(java.lang.String name)
          Return specific support for path mapping for paths obtained from personal builds changelists
 java.util.List<SVcsRoot> findVcsRootsByScope(VcsRootScope scope)
          Returns all VCS roots having specified scope.
 java.util.List<SBuildType> getAllConfigurationUsages(jetbrains.buildServer.vcs.VcsRoot root)
          Returns all configuratons which use the root.
 java.util.List<SProject> getAllProjectUsages(jetbrains.buildServer.vcs.VcsRoot root)
          returns all project which contain configuratons which use the root.
 java.util.List<SVcsRoot> getAllRegisteredVcsRoots()
          returns list of all registered vcs roots
 java.util.Collection<VcsSupport> getAllVcs()
           
 byte[] getFileContent(Build build, java.lang.String filePath)
          Get binary content of the single file in modification set.
 byte[] getFileContent(java.util.List<jetbrains.buildServer.vcs.VcsRootEntry> vcsRootEntries, java.lang.String relativePath)
          Get the latest file content, searching it in the provided list of VCS roots
 byte[] getFileContent(SBuildType buildType, java.lang.String relativePath)
          Get latest file content for given relative path in the given build configuration.
 java.util.Collection<SUser> getModificationUsers(SVcsModification modification)
           
 int getNumberOfUsagesInConfigurations(jetbrains.buildServer.vcs.VcsRoot root)
          Returns number of usages of the specified VCS root in build configurations
 int getNumberOfUsagesInProjects(jetbrains.buildServer.vcs.VcsRoot root)
          Returns number of usages of this VCS root in projects build configurations
 VcsRootStatus getStatus(SVcsRoot vcsRoot)
          Provides current status of the given vcs root.
 VcsModificationHistory getVcsHistory()
           
 java.util.Map<SVcsRoot,java.lang.String> getVcsRootsUsernames(User user)
          Returns VCS root specific user names defined by the specified user.
 VersionSupport<SVcsRoot> getVcsRootVersionSupport()
          Return the component responsible for versioning support of VCS roots
 VcsStatusProvider getVcsStatusProvider()
          Returns a component which can be used to detect/report a status of a version control system root in a particular build configuration.
 java.util.Map<VcsSupport,java.lang.String> getVcsUsernames(User user)
          Returns default usernames for all VCS roots of a VCS plugin.
 void registerVcsSupport(VcsSupport vcsSupport)
          Registers version control integration plugin instance.
 void unregisterVcsSupport(VcsSupport vcsSupport)
          Unregister previously registered VcsSupport
 
Methods inherited from interface jetbrains.buildServer.vcs.VcsRootsUpdate
createNewVcsRoot, createNewVcsRoot, persistVcsRoots, removeVcsRoot, setVcsRootScope, updateVcsRoot
 

Method Detail

registerVcsSupport

void registerVcsSupport(VcsSupport vcsSupport)
Registers version control integration plugin instance.

Parameters:
vcsSupport - version control support instance.

unregisterVcsSupport

void unregisterVcsSupport(VcsSupport vcsSupport)
Unregister previously registered VcsSupport

Parameters:
vcsSupport - to be unregistered

findVcsByName

@Nullable
VcsSupport findVcsByName(java.lang.String name)
Try to find and return VcsSupport

Parameters:
name - name of VcsSupport to find
Returns:
Found VcsSupport with given name

findVcsPersonalSupportByName

@Nullable
VcsPersonalSupport findVcsPersonalSupportByName(java.lang.String name)
Return specific support for path mapping for paths obtained from personal builds changelists

Parameters:
name - VCS name
Returns:
vcs support for personal builds/delayed commits
See Also:
VcsPersonalSupport

getAllVcs

java.util.Collection<VcsSupport> getAllVcs()
Returns:
Collection of all registered VcsSupports

getVcsHistory

VcsModificationHistory getVcsHistory()
Returns:
manager for detected VCS changes (i.e. user commits)

getFileContent

@NotNull
byte[] getFileContent(Build build,
                              java.lang.String filePath)
                      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
build - build for which file content should be obtained
Returns:
- specified file content, corresponding to the build
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.

getFileContent

@Nullable
byte[] getFileContent(@NotNull
                               SBuildType buildType,
                               @Nullable
                               java.lang.String relativePath)
                      throws jetbrains.buildServer.vcs.VcsException
Get latest file content for given relative path in the given build configuration.

Parameters:
buildType - build configuration
relativePath - relative path to the file to be searched in the project VCS roots
Returns:
null if no corresponding file found
Throws:
VcsException - when VCS access problem occures

getFileContent

@Nullable
byte[] getFileContent(java.util.List<jetbrains.buildServer.vcs.VcsRootEntry> vcsRootEntries,
                               @Nullable
                               java.lang.String relativePath)
                      throws jetbrains.buildServer.vcs.VcsException
Get the latest file content, searching it in the provided list of VCS roots

Parameters:
vcsRootEntries - search file content in a given list of VCS root entries
relativePath - relative path to the file to be searched in the project VCS roots
Returns:
null if no corresponding file found
Throws:
VcsException - when VCS access problem occures
See Also:
VcsRootEntry

getVcsStatusProvider

VcsStatusProvider getVcsStatusProvider()
Returns a component which can be used to detect/report a status of a version control system root in a particular build configuration.

Returns:
see above

getAllRegisteredVcsRoots

java.util.List<SVcsRoot> getAllRegisteredVcsRoots()
returns list of all registered vcs roots

Returns:
see above

findVcsRootsByScope

java.util.List<SVcsRoot> findVcsRootsByScope(@NotNull
                                             VcsRootScope scope)
Returns all VCS roots having specified scope.

Parameters:
scope - scope of VCS roots
Returns:
all VCS roots with specified scope

findUnusedVcsRootsByScope

java.util.List<SVcsRoot> findUnusedVcsRootsByScope(@NotNull
                                                   VcsRootScope scope)
Returns list of VCS roots having specified scope and having no usages in build configurations.

Parameters:
scope - scope to filter VCS roots
Returns:
list of unused VCS roots

getAllProjectUsages

java.util.List<SProject> getAllProjectUsages(jetbrains.buildServer.vcs.VcsRoot root)
returns all project which contain configuratons which use the root. Projects are sorted by name.

Parameters:
root - specified vcs root
Returns:
all root usages in projects

getNumberOfUsagesInProjects

int getNumberOfUsagesInProjects(jetbrains.buildServer.vcs.VcsRoot root)
Returns number of usages of this VCS root in projects build configurations

Parameters:
root - VCS root whose usages should be found
Returns:
see above

getAllConfigurationUsages

java.util.List<SBuildType> getAllConfigurationUsages(jetbrains.buildServer.vcs.VcsRoot root)
Returns all configuratons which use the root. Build configurations are sorted by project name then by build configuration name.

Parameters:
root - specified vcs root
Returns:
all root usages in configuration

getNumberOfUsagesInConfigurations

int getNumberOfUsagesInConfigurations(jetbrains.buildServer.vcs.VcsRoot root)
Returns number of usages of the specified VCS root in build configurations

Parameters:
root - VCS root whose usages are searched for
Returns:
see above

findRootById

@Nullable
SVcsRoot findRootById(long id)
returns vcs root with specified id

Parameters:
id - vcs root id
Returns:
vcs root by id

findRootByName

@Nullable
SVcsRoot findRootByName(@NotNull
                                 java.lang.String name)
Returns VCS root having the specified name

Parameters:
name - name of VcsRoot
Returns:
VCS root having specified name or null

getVcsRootVersionSupport

VersionSupport<SVcsRoot> getVcsRootVersionSupport()
Return the component responsible for versioning support of VCS roots

Returns:
see above

findRootByIdAndVersion

@Nullable
SVcsRoot findRootByIdAndVersion(long rootId,
                                         long versionId)
Find a VCS root with given id and given version

Parameters:
rootId - VCS root id, see VcsRoot#getId
versionId - VCS root version, see VcsRoot#getRootVersion
Returns:
see above

getModificationUsers

java.util.Collection<SUser> getModificationUsers(SVcsModification modification)
Parameters:
modification - VCS modification
Returns:
collection of users who contributed to the given VCS modification

getVcsRootsUsernames

java.util.Map<SVcsRoot,java.lang.String> getVcsRootsUsernames(User user)
Returns VCS root specific user names defined by the specified user.

Parameters:
user - whose VCS usernames are returned
Returns:
map of VCS root to user name

getVcsUsernames

java.util.Map<VcsSupport,java.lang.String> getVcsUsernames(User user)
Returns default usernames for all VCS roots of a VCS plugin.

Parameters:
user - whose VCS usernames are returned
Returns:
map of VCS plugin to user name

findModificationById

@Nullable
SVcsModification findModificationById(long changeId,
                                               boolean isPersonal)
Find and return VCS modification by its id and isPersonal flag.

Parameters:
changeId - VCS modification identifier, see VcsModification.getId()
isPersonal - true if the searched modification relates to personal build
Returns:
see above TODO: remove this method from here.

getStatus

VcsRootStatus getStatus(SVcsRoot vcsRoot)
Provides current status of the given vcs root. Can be
- last checked at
Parameters:
vcsRoot - vcs root to get status for
Returns:
given root status