Package jetbrains.buildServer.vcs.utils
Class VcsPluginUtil
- java.lang.Object
-
- jetbrains.buildServer.vcs.utils.VcsPluginUtil
-
- Direct Known Subclasses:
VcsSupportUtil
public class VcsPluginUtil extends java.lang.Object
Created 28.09.12 19:36- Since:
- 8.0
- Author:
- Eugene Petrenko (eugene.petrenko@jetbrains.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
VcsPluginUtil.IncludeRuleHandler
-
Constructor Summary
Constructors Constructor Description VcsPluginUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
buildPatch(VcsRoot root, java.lang.String fromVersion, java.lang.String toVersion, PatchBuilder builder, CheckoutRules checkoutRules, BuildPatchByIncludeRules patcher)
Service method, allows to build patch for each root include rule in the specified checkout rulesstatic java.util.List<ModificationData>
collectBuildChanges(VcsRoot root, java.lang.String fromVersion, java.lang.String toVersion, CheckoutRules commonRule, CollectChangesByIncludeRules collector)
Util method, can be used with CollectChangesByIncludeRules to collect all changes for a set of CheckoutRulesstatic java.util.List<ModificationData>
collectBuildChanges(VcsRoot root, java.lang.String fromVersion, java.lang.String toVersion, CheckoutRules commonRule, CollectSingleStateChangesByIncludeRules collector)
Util method, can be used with CollectSingleStateChangesByIncludeRules to collect all changes for a set of CheckoutRulesstatic java.lang.String
getRepositoryVersion(VcsRepositoryState state)
Service method, which allows to obtain String representation of VcsRepositoryState for VCSs, having only one branchstatic void
processIncludeRules(CheckoutRules rules, VcsPluginUtil.IncludeRuleHandler processor)
Process each include rule from checkout rules.static ModificationData
processRelativePaths(ModificationData change, IncludeRule includeRule)
static java.lang.String
removeFromAddTo(java.lang.String path, IncludeRule includeRule)
In path, replaces includeRule.getFrom with includeRule.getTostatic boolean
shouldDebugVcsCallsFor(java.lang.String fullPath)
This is an auxiliary method which allows to check for deep debugging of VCS calls.
-
-
-
Method Detail
-
collectBuildChanges
public static java.util.List<ModificationData> collectBuildChanges(@NotNull VcsRoot root, @NotNull java.lang.String fromVersion, @Nullable java.lang.String toVersion, @NotNull CheckoutRules commonRule, @NotNull CollectChangesByIncludeRules collector) throws VcsException
Util method, can be used with CollectChangesByIncludeRules to collect all changes for a set of CheckoutRules- Parameters:
root
- vcs root to collect changes forfromVersion
- version to collect changes from (excluding this version)toVersion
- version to collect changes to (including this version)commonRule
- checkout rule to collect changes forcollector
- interface which collects changes for include rules- Returns:
- collected changes
- Throws:
VcsIncludeRulesException
- rethrows exception, thrown byCollectChangesByIncludeRules
implementation object, and contains failing IncludeRules from passed CheckoutRules objectVcsException
-
collectBuildChanges
public static java.util.List<ModificationData> collectBuildChanges(@NotNull VcsRoot root, @NotNull java.lang.String fromVersion, @Nullable java.lang.String toVersion, @NotNull CheckoutRules commonRule, @NotNull CollectSingleStateChangesByIncludeRules collector) throws VcsException
Util method, can be used with CollectSingleStateChangesByIncludeRules to collect all changes for a set of CheckoutRules- Parameters:
root
- vcs root to collect changes forfromVersion
- version to collect changes from (excluding this version)toVersion
- version to collect changes to (including this version)commonRule
- checkout rule to collect changes forcollector
- interface which collects changes for include rules- Returns:
- collected changes
- Throws:
VcsIncludeRulesException
- rethrows exception, thrown byCollectSingleStateChangesByIncludeRules
implementation object, and contains failing IncludeRules from passed CheckoutRules objectVcsException
-
processIncludeRules
public static void processIncludeRules(CheckoutRules rules, VcsPluginUtil.IncludeRuleHandler processor) throws VcsIncludeRulesException
Process each include rule from checkout rules. In a case of VcsException, collect those exceptions and throw a combined VcsIncludeRulesException- Throws:
VcsIncludeRulesException
- combined exception with errors for each failing include rule- Since:
- 10.0
-
processRelativePaths
@NotNull public static ModificationData processRelativePaths(@NotNull ModificationData change, @NotNull IncludeRule includeRule)
-
removeFromAddTo
@Nullable public static java.lang.String removeFromAddTo(@NotNull java.lang.String path, @NotNull IncludeRule includeRule)
In path, replaces includeRule.getFrom with includeRule.getTo- Parameters:
path
- path for replacementincludeRule
- include rule- Returns:
- see above
- Since:
- 5.0
-
buildPatch
public static void buildPatch(@NotNull VcsRoot root, @Nullable java.lang.String fromVersion, @NotNull java.lang.String toVersion, @NotNull PatchBuilder builder, @NotNull CheckoutRules checkoutRules, @NotNull BuildPatchByIncludeRules patcher) throws java.io.IOException, VcsException
Service method, allows to build patch for each root include rule in the specified checkout rules- Parameters:
root
- vcs root to build patch forfromVersion
- version to build patch fromtoVersion
- version to build patch tobuilder
- patch buildercheckoutRules
- rules to build patch for (rules how to map repository file names to working ones)patcher
- implementation, builds patch for one specified include rule- Throws:
java.io.IOException
- exception occurred while sending patch to patch builderVcsException
- exception occurred while getting patch from version control
-
getRepositoryVersion
@NotNull public static java.lang.String getRepositoryVersion(@NotNull VcsRepositoryState state)
Service method, which allows to obtain String representation of VcsRepositoryState for VCSs, having only one branch- Parameters:
state
- repository state to convert- Returns:
- String representation of VcsRepositoryState
- Throws:
java.lang.IllegalArgumentException
- if provided state either contains information for multiple branches or is empty- Since:
- 8.1
-
shouldDebugVcsCallsFor
public static boolean shouldDebugVcsCallsFor(@NotNull java.lang.String fullPath)
This is an auxiliary method which allows to check for deep debugging of VCS calls. The idea is that for debugging purpose, a user may set `teamcity.vcs.debug.path` system property in internal.properties file If this fragment is set, VCS support may use this method to check whether to perform detailed debugging for the path. Initially this method was supposed to be used with `mapFullPath` method inVcsPersonalSupport
to get suitable configurations.- Parameters:
fullPath
- path to be considered- Returns:
- true if this detailed debug logging should be performed for this path.
- Since:
- 9.1
-
-