Class MockVcsSupport

    • Constructor Detail

      • MockVcsSupport

        public MockVcsSupport​(String name)
    • Method Detail

      • setDAGBased

        public void setDAGBased​(boolean dagBased)
      • buildPatch

        public void buildPatch​(@NotNull
                               VcsRoot root,
                               String fromVersion,
                               @NotNull
                               String toVersion,
                               @NotNull
                               PatchBuilder builder,
                               @NotNull
                               CheckoutRules checkoutRules)
                        throws IOException,
                               VcsException
        Description copied from interface: BuildPatchByCheckoutRules
        Called to retrieve detailed info on modification between two given revisions. Results are to be fed to the builder passed.
        Specified by:
        buildPatch in interface BuildPatchByCheckoutRules
        Parameters:
        root - current settings
        fromVersion - collect files, changed since this version. If it is null, collect all project files for 'toVersion' parameter (full checkout patch).
        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 get.
        Throws:
        IOException - rethrow this exception, if it will be thrown from some PatchBuilder method
        VcsException - throw this exception if some problem occurred while collecting changes or changes cannot be collected because of invalid configuration. Localized message will be shown on the web page for the corresponding project.
        IncrementalPatchImpossibleException - if this exception is thrown during building an incremental patch (fromVersion is not null) this method will be called again with fromVersion set to null, i.e. full checkout patch will be requested. This is useful for the situation when the underlying VCS repository has forgotten the fromVersion for some reason and therefore VCS support is unable to extract the differences.
        See Also:
        service class prevents you from manual mapping of file pathes.
      • getContent

        @NotNull
        public byte[] getContent​(@NotNull
                                 VcsModification parentModification,
                                 @NotNull
                                 VcsChangeInfo change,
                                 @NotNull
                                 VcsChangeInfo.ContentType contentType,
                                 @NotNull
                                 VcsRoot vcsRoot)
                          throws VcsException
        Description copied from interface: VcsFileContentProvider
        Get binary content of the single file in modification set.
        Specified by:
        getContent in interface VcsFileContentProvider
        Parameters:
        parentModification - modification set.
        change - specified change of file.
        contentType - specified what content should be return - before modification or after it.
        vcsRoot - current settings.
        Returns:
        content of the file specified by VcsChange, by version, specified in 'contentType' parameter.
        Throws:
        VcsException - if some problem occurred.
        VcsFileNotFoundException - when no such file found. If "file not found" condition cannot be detected easily the implementation may throw jetbrains.buildServer.vcs.VcsException. In this case some TeamCity functions may work inefficiently, for example the file content cache.
      • setContent

        public void setContent​(@NotNull
                               VcsRoot root,
                               @NotNull
                               String revision,
                               @NotNull
                               String path,
                               @Nullable
                               Object content)
        Sets result of next getContent call. Content can be a byte array of a file content, a VcsException or RuntimeException. If content is an exception - it is thrown during getContent operation.
      • getName

        @NotNull
        public String getName()
        Description copied from interface: VcsSupportConfig
        Unique VCS identifier among other installed plugins.
        Specified by:
        getName in interface VcsSupportConfig
        Returns:
        - unique version control name
      • getCurrentVersion

        @NotNull
        public String getCurrentVersion​(@NotNull
                                        VcsRoot root)
                                 throws VcsException
        Description copied from class: ServerVcsSupport
        Repository state is now implemented via jetbrains.buildServer.vcs.CollectChangesPolicy, this method is left here for compatibility
        Specified by:
        getCurrentVersion in interface CollectSingleStatePolicy
        Overrides:
        getCurrentVersion in class ServerVcsSupport
        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 changes or changes cannot be collected because of invalid configuration. Localized message will be shown on the web page for the corresponding project.
      • getRootId

        protected long getRootId​(VcsRoot root)
      • describeVcsRoot

        @NotNull
        public String describeVcsRoot​(@NotNull
                                      VcsRoot vcsRoot)
        Description copied from interface: VcsSupportConfig
        Returns presentable text describing specified vcs root, for example: svn: http://www.somehost.com/project/
        Specified by:
        describeVcsRoot in interface VcsSupportConfig
        Parameters:
        vcsRoot - vcs root to describe
        Returns:
        vcs root description
      • isTestConnectionSupported

        public boolean isTestConnectionSupported()
      • getRequestedPatchVersions

        public List<String> getRequestedPatchVersions()
      • clearRequestedPathVersions

        public void clearRequestedPathVersions()
      • getContent

        @NotNull
        public byte[] getContent​(@NotNull
                                 String filePath,
                                 @NotNull
                                 VcsRoot versionedRoot,
                                 @NotNull
                                 String version)
                          throws VcsException
        Description copied from interface: VcsFileContentProvider
        Get binary content of the single file in modification set.
        Specified by:
        getContent in interface VcsFileContentProvider
        Parameters:
        filePath - file path relative to the project root, "checkout root" from vcs root should not be included
        versionedRoot - current settings.
        version - version returned by VcsModification.getVersion() or check jetbrains.buildServer.vcs.CollectChangesPolicy.
        Returns:
        specified file content, corresponding to the repository version specified in 'version' parameter.
        Throws:
        VcsException - if some problem occurred.
        VcsFileNotFoundException - when no such file found. If "file not found" condition cannot be detected easily the implementation may throw jetbrains.buildServer.vcs.VcsException. In this case some TeamCity functions may work inefficiently, for example the file content cache.
      • testConnection

        public String testConnection​(@NotNull
                                     VcsRoot vcsRoot)
                              throws VcsException
        Description copied from interface: TestConnectionSupport
        Called to test connection to the given VCS root.
        Specified by:
        testConnection in interface TestConnectionSupport
        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
      • getVersionDisplayName

        @NotNull
        public String getVersionDisplayName​(@NotNull
                                            String version,
                                            @NotNull
                                            VcsRoot root)
                                     throws VcsException
        Description copied from interface: VcsSupportConfig
        Returns readable presentation of version (this format should be the same as DisplayVersion of VcsModification)
        Specified by:
        getVersionDisplayName in interface VcsSupportConfig
        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.
      • isAgentSideCheckoutAvailable

        public boolean isAgentSideCheckoutAvailable()
        Specified by:
        isAgentSideCheckoutAvailable in interface VcsSupportConfig
        Returns:
        boolean value indicating agent side checkout ability support
      • setAgentSideCheckoutAvailable

        public void setAgentSideCheckoutAvailable​(boolean agentSideCheckoutAvailable)
      • setDisplayName

        public void setDisplayName​(String rev,
                                   @Nullable
                                   String revDisplayName)
      • setIgnoreServerCaches

        public void setIgnoreServerCaches​(boolean b)
      • allowSourceCaching

        public boolean allowSourceCaching()
        Specified by:
        allowSourceCaching in interface VcsSupportCore
        Returns:
        true if you want TeamCity to use its internal source cache to reuse patches retrieved earlier and minimize patch building. Returning false may have sense if the underlying version control system has its own effective local caching system (e.g. Mercurial).
      • sourcesUpdatePossibleIfChangesNotFound

        public boolean sourcesUpdatePossibleIfChangesNotFound​(@NotNull
                                                              VcsRoot root)
        Description copied from interface: VcsSupportCore
        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. Note that if true is returned for some VCS root, plugin should be able to correctly build patch for this VCS root.
        For example, if plugin performs changes collecting in the buildPatch method and then creates patch by detected changes, it should create clean patch for VCS root for which it returned true in this method.
        Specified by:
        sourcesUpdatePossibleIfChangesNotFound in interface VcsSupportCore
        Parameters:
        root - VCS root
        Returns:
        see above
      • setSourcesUpdatePossibleIfChangesNotFound

        public void setSourcesUpdatePossibleIfChangesNotFound​(boolean sourcesCanBeUpdatedWithoutChanges)
      • setCollectChangesPolicy

        public void setCollectChangesPolicy​(@Nullable
                                            CollectChangesPolicy policy)
      • collectChanges

        public List<ModificationData> collectChanges​(@NotNull
                                                     VcsRoot root,
                                                     @NotNull
                                                     String fromVersion,
                                                     @Nullable
                                                     String currentVersion,
                                                     @NotNull
                                                     CheckoutRules checkoutRules)
                                              throws VcsException
        Description copied from interface: CollectSingleStateChangesByCheckoutRules
        Returns list of the changes between two revisions given. Check VcsSupportCore.isCurrentVersionExpensive() if you like to have null for currentVersion
        Specified by:
        collectChanges in interface CollectSingleStateChangesByCheckoutRules
        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 paths according to include rules. see jetbrains.buildServer.vcs.VcsSupportUtil#collectBuildChanges(jetbrains.buildServer.vcs.VcsRoot, String, String, jetbrains.buildServer.vcs.CheckoutRules, jetbrains.buildServer.CollectChangesByIncludeRules) service method, which allows you to collect changes for each root include rule.
        Returns:
        list of changes between specified versions.
        Throws:
        VcsException - throw this exception if some problem occurred while collecting changes or changes cannot be collected because of invalid configuration. Localized message will be shown on the web page for the corresponding project
      • getRequestedChangesVersions

        public List<String> getRequestedChangesVersions()
      • clearRequestedChangesVersions

        public void clearRequestedChangesVersions()
      • convertToVcsRootProperties

        @Nullable
        public Map<String,​String> convertToVcsRootProperties​(@NotNull
                                                                   VcsUrl url)
        Description copied from interface: UrlSupport
        Converts the given url to a set of VCS root properties valid enough for creating a VCS root.
        Specified by:
        convertToVcsRootProperties in interface UrlSupport
        Parameters:
        url - url to repository with optional credentials
        Returns:
        the VCS root properties if url belongs to this VCS plugin or null if it does not belong
      • getLabelingSupport

        public LabelingSupport getLabelingSupport()
        Specified by:
        getLabelingSupport in interface VcsSupportContext
        Returns:
        if the implementation supports labeling this method returns VcsPersonalSupport implementation. Otherwise null.
      • isCurrentVersionExpensive

        public boolean isCurrentVersionExpensive()
        Description copied from interface: VcsSupportCore
        If the obtaining current version is an expensive operation (see CollectSingleStatePolicy#getCurrentVersion(VcsRoot)}) the implementation may optimize performance by returning true. In this case collecting changes for the current version will be done without specifying upper version. Otherwise CollectSingleStatePolicy.getCurrentVersion(VcsRoot) will be called first and then the result will be passed to the change collector as the upper version.
        Specified by:
        isCurrentVersionExpensive in interface VcsSupportCore
        Returns:
        true if the obtaining current version is an expensive operation.
        See Also:
        CollectChangesPolicy
      • addCustomVcsExtension

        public <T extends VcsExtension> void addCustomVcsExtension​(@NotNull
                                                                   Class<T> extensionClass,
                                                                   T extension)
      • resetChanges

        public void resetChanges​(@NotNull
                                 VcsRoot root)
      • getVcsRootIdentity

        @NotNull
        public String getVcsRootIdentity​(@NotNull
                                         VcsRoot vcsRoot)
                                  throws VcsException
        Description copied from interface: VcsRootIdentityProvider
        For the provided VCS root calculate identity, which can be used by TeamCity core to decide if two VCS root represent the same or different repositories
        Specified by:
        getVcsRootIdentity in interface VcsRootIdentityProvider
        Parameters:
        vcsRoot - VCS Root to get identity for
        Returns:
        see above
        Throws:
        VcsException - in case of VCS problem
      • getDefaultBranchName

        @Nullable
        public String getDefaultBranchName​(@NotNull
                                           VcsRoot vcsRoot)
        Specified by:
        getDefaultBranchName in interface VcsRootIdentityProvider
        Returns:
        which branch should be treated as default to be used by TeamCity core e.g. to compare current states or null if not applicable