jetbrains.buildServer.vcs
Interface VcsManager

All Superinterfaces:
VcsRegistry, VcsRootsUpdate, VcsServiceFactory, VcsServiceProvider

public interface VcsManager
extends VcsRootsUpdate, VcsRegistry, VcsServiceFactory

A basic starting point for various VCS - related operations, 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 findRootByExternalId(java.lang.String vcsRootExternalId)
          returns vcs root with specified external id
 SVcsRoot findRootById(long id)
          returns vcs root with specified id
 SVcsRoot findRootByIdAndVersion(long rootId, long versionId)
          Deprecated. since 6.5
 SVcsRoot findRootByName(java.lang.String name)
          Deprecated. since 8.0
 VcsRootInstance findRootInstanceById(long id)
           
 java.util.Collection<? extends SVcsRoot> findRootsByVcsName(java.lang.String vcsSupportName)
          Returns collection of VCS roots corresponding to VcsSupport with specified name (see VcsSupportConfig.getName())
 java.util.List<SVcsRoot> findUnusedVcsRootsByScope(VcsRootScope scope)
          Returns list of VCS roots having specified scope and having no usages in build configurations.
 VcsSupportContext findVcsContextByName(java.lang.String name)
          Deprecated. since 8.0, you should use VcsServiceProvider methods to obtain VcsService classes
 java.util.Collection<? extends SVcsRoot> findVcsRoots(java.util.Collection<java.lang.Long> ids)
          returns available vcs roots with the given ids
 java.util.List<SVcsRoot> findVcsRootsByScope(VcsRootScope scope)
          Returns all VCS roots having specified scope.
 java.util.List<SBuildType> getAllConfigurationUsages(VcsRoot root)
          Returns all configurations which use the root.
 java.util.List<SProject> getAllProjectUsages(VcsRoot root)
          returns all project which contain configurations which use the root.
 java.util.List<SVcsRoot> getAllRegisteredVcsRoots()
          returns list of all registered vcs roots
 java.util.List<BuildTypeTemplate> getAllTemplateUsages(VcsRoot root)
          Returns all templates with specified vcs root attached.
 java.util.Collection<VcsSupportContext> getAllVcs()
          Deprecated. since 8.0, you should use VcsRegistry.getAllVcsCore() method
 byte[] getFileContent(Build build, java.lang.String filePath)
          Get binary content of the single file in modification set.
 byte[] getFileContent(java.util.List<VcsRootInstanceEntry> 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)
          Deprecated. use SVcsModification.getCommitters()
 int getNumberOfUsagesInConfigurations(VcsRoot root)
          Returns number of usages of the specified VCS root in build configurations
 int getNumberOfUsagesInProjects(VcsRoot root)
          Returns number of usages of this VCS root in projects build configurations and templates
 VcsRootStatus getStatus(SVcsRoot vcsRoot)
          Provides current status of the given vcs root.
 java.util.Collection<SUser> getUsers(VcsRoot root, java.lang.String username)
          Returns users which have specified username in their vcs settings (either in settings of whole VCS or in settings of specified VCS root)
 VcsModificationHistory getVcsHistory()
           
 VcsRootInstance getVcsRootInstance(SVcsRoot parent, java.util.Map<java.lang.String,java.lang.String> params)
          Returns VCS root instance from the specified parent VCS root and new parameters.
 java.util.Map<SVcsRoot,java.lang.String> getVcsRootsUsernames(User user)
          Returns VCS root specific user names defined by the specified user.
 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<VcsSupportCore,java.lang.String> getVcsUsernames(User user)
          Returns default usernames for all VCS roots of a VCS plugin.
 
Methods inherited from interface jetbrains.buildServer.vcs.VcsRootsUpdate
createNewVcsRoot, createNewVcsRoot, createNewVcsRoot, persistVcsRoots, removeVcsRoot, setVcsRootScope, updateVcsRoot
 
Methods inherited from interface jetbrains.buildServer.vcs.VcsRegistry
findVcsByName, getAllVcsCore
 
Methods inherited from interface jetbrains.vcs.api.VcsServiceProvider
getGenericService, getVcsService
 

Method Detail

getVcsHistory

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

getFileContent

@NotNull
byte[] getFileContent(Build build,
                              java.lang.String filePath)
                      throws 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 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 occurs

getFileContent

@Nullable
byte[] getFileContent(@NotNull
                               java.util.List<VcsRootInstanceEntry> vcsRootEntries,
                               @Nullable
                               java.lang.String relativePath)
                      throws 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 occurs
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

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

@NotNull
java.util.List<SProject> getAllProjectUsages(@NotNull
                                                     VcsRoot root)
returns all project which contain configurations which use the root. Projects are sorted by name.

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

getNumberOfUsagesInProjects

int getNumberOfUsagesInProjects(VcsRoot root)
Returns number of usages of this VCS root in projects build configurations and templates

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

getAllConfigurationUsages

java.util.List<SBuildType> getAllConfigurationUsages(VcsRoot root)
Returns all configurations 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

getAllTemplateUsages

@NotNull
java.util.List<BuildTypeTemplate> getAllTemplateUsages(@NotNull
                                                               VcsRoot root)
Returns all templates with specified vcs root attached.

Parameters:
root - vcs root
Returns:
all templates with specified vcs root
Since:
5.0

getNumberOfUsagesInConfigurations

int getNumberOfUsagesInConfigurations(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

findRootByExternalId

@Nullable
SVcsRoot findRootByExternalId(@Nullable
                                       java.lang.String vcsRootExternalId)
returns vcs root with specified external id

Parameters:
vcsRootExternalId - vcs root external id
Returns:
vcs root by external id
Since:
8.0

findRootInstanceById

@Nullable
VcsRootInstance findRootInstanceById(long id)
Parameters:
id - id of the VCS root instance
Returns:
VCS root instance with specified id
Since:
6.5

getVcsRootInstance

@NotNull
VcsRootInstance getVcsRootInstance(@NotNull
                                           SVcsRoot parent,
                                           @NotNull
                                           java.util.Map<java.lang.String,java.lang.String> params)
Returns VCS root instance from the specified parent VCS root and new parameters.

Parameters:
parent - parent VCS root for the instance
params - new VCS root instance parameters
Returns:
new VCS root instance
Since:
6.5

findRootByName

@Nullable
SVcsRoot findRootByName(@NotNull
                                 java.lang.String name)
Deprecated. since 8.0

Returns first VCS root having the specified name

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

findVcsRoots

@NotNull
java.util.Collection<? extends SVcsRoot> findVcsRoots(@NotNull
                                                              java.util.Collection<java.lang.Long> ids)
returns available vcs roots with the given ids

Parameters:
ids - root ids
Returns:
collection of available object identified by the given ids
Since:
5.0

findRootsByVcsName

@NotNull
java.util.Collection<? extends SVcsRoot> findRootsByVcsName(java.lang.String vcsSupportName)
Returns collection of VCS roots corresponding to VcsSupport with specified name (see VcsSupportConfig.getName())

Parameters:
vcsSupportName - name of VcsSupport
Returns:
see above
Since:
6.0

findRootByIdAndVersion

@Nullable
SVcsRoot findRootByIdAndVersion(long rootId,
                                         long versionId)
Deprecated. since 6.5

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)
Deprecated. use SVcsModification.getCommitters()

Parameters:
modification - VCS modification
Returns:
collection of users who contributed to the given VCS modification

getUsers

@NotNull
java.util.Collection<SUser> getUsers(@NotNull
                                             VcsRoot root,
                                             @Nullable
                                             java.lang.String username)
Returns users which have specified username in their vcs settings (either in settings of whole VCS or in settings of specified VCS root)

Parameters:
root - root of interest
username - name of interest
Returns:
see above
Since:
6.5.1

getVcsRootsUsernames

@NotNull
java.util.Map<SVcsRoot,java.lang.String> getVcsRootsUsernames(@NotNull
                                                                      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

@NotNull
java.util.Map<VcsSupportCore,java.lang.String> getVcsUsernames(@NotNull
                                                                       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

findVcsContextByName

@Nullable
VcsSupportContext findVcsContextByName(@NotNull
                                                java.lang.String name)
Deprecated. since 8.0, you should use VcsServiceProvider methods to obtain VcsService classes

Try to find and return VcsSupportContext

Parameters:
name - name of VcsSupport to find
Returns:
Found VcsSupport with given name
Since:
4.5
See Also:
VcsServiceProvider

getAllVcs

@NotNull
java.util.Collection<VcsSupportContext> getAllVcs()
Deprecated. since 8.0, you should use VcsRegistry.getAllVcsCore() method

Returns:
Collection of all registered VcsSupports
Since:
4.5