Package jetbrains.buildServer.vcs
Class CheckoutRules
- java.lang.Object
-
- jetbrains.buildServer.vcs.FileRuleSet<IncludeRule,FileRule>
-
- jetbrains.buildServer.vcs.CheckoutRules
-
- All Implemented Interfaces:
Loggable
public class CheckoutRules extends FileRuleSet<IncludeRule,FileRule>
Contains a number of rules how to layout project sources on agent side.
-
-
Field Summary
Fields Modifier and Type Field Description static CheckoutRulesDEFAULTstatic StringINCLUDE_SEP-
Fields inherited from class jetbrains.buildServer.vcs.FileRuleSet
EXCLUDE_PREFIX, IGNORE_CASE_MARK, INCLUDE_PREFIX
-
-
Constructor Summary
Constructors Constructor Description CheckoutRules(String body)Creates new checkout rules instance on string rules presentation.CheckoutRules(List<String> lines)Creates new checkout rules instance on a list of string rules.CheckoutRules(List<IncludeRule> includeRules, List<FileRule> excludeRules)Creates rules object on include and exclude rules lists.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsWildcards()Checks if some rule from the set contains wildcards.static CheckoutRulescreateCommonRule(List<CheckoutRules> ruleses)Creates 'union' ruleprotected FileRulecreateNewExcludeRule(String line)protected FileRulecreateNewExcludeRule(FileRule rule)protected IncludeRulecreateNewIncludeRule(String rule)protected IncludeRulecreateNewIncludeRule(IncludeRule includeRule)CheckoutRulescreateNewRulesForPrefix(String prefixPath)Creates new checkout rule set with prefix appended to every rule right part.static CheckoutRulescreateOn(String ruleStr)Creates new rule set on the specified rules string presentation.protected voiddoPostInitProcess(List<IncludeRule> includeRules, List<FileRule> excludeRules)StringgetAsString()List<IncludeRule>getRootIncludeRules()Returns include rules sorted by from part.booleanincludesAny(Collection<String> paths)Returns true if these checkout rules include at least one of the specified paths.static booleanisCorrect(String line)Returns true if line represents syntactically correct include or exclude rule.booleanisIncludeAll()Stringmap(String path)Maps vcs relative file path to path described by checkout rules.Collection<String>map(Collection<String> paths)Maps a collection of vcs relative file path to path described by checkout rules, non-matched paths from the collection is skippedprotected voidpostProcessCreatedRules(List<IncludeRule> includeRules, List<FileRule> excludeRules)booleanshouldInclude(String path)booleanshouldInclude(String path, Map<String,String> props)protected booleanshouldInclude(String path, Filter<FileRule> includeExcludeRulesFilter)booleanshouldInclude(String path, IncludeRule rule)StringtoString()-
Methods inherited from class jetbrains.buildServer.vcs.FileRuleSet
convertToLines, createPropertiesFilter, describe, equals, findMostSpecific, getBody, getExcludeRules, getExcludeRules, getIncludeRuleFor, getIncludeRuleMerged, getIncludeRules, getIncludeRules, hashCode, isEmpty, isIgnoreCase, isSubDir, isUnder, preparePath, setIgnoreCase, shouldInclude, sortByFrom
-
-
-
-
Field Detail
-
DEFAULT
public static final CheckoutRules DEFAULT
-
INCLUDE_SEP
public static final String INCLUDE_SEP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CheckoutRules
public CheckoutRules(@NotNull List<String> lines)Creates new checkout rules instance on a list of string rules.- Parameters:
lines- list of string rules, lines should not contain newline characters
-
CheckoutRules
public CheckoutRules(@NotNull String body)Creates new checkout rules instance on string rules presentation.- Parameters:
body- string rule presentation.
-
CheckoutRules
public CheckoutRules(@NotNull List<IncludeRule> includeRules, @NotNull List<FileRule> excludeRules)Creates rules object on include and exclude rules lists.- Parameters:
includeRules- include rules list.excludeRules- exclude rules list.
-
-
Method Detail
-
map
@NotNull public Collection<String> map(@NotNull Collection<String> paths)
Maps a collection of vcs relative file path to path described by checkout rules, non-matched paths from the collection is skipped- Parameters:
paths- to map- Returns:
- collection of paths which were successfully matched
- Since:
- 10.0
- See Also:
map(String)
-
map
@Nullable public String map(String path)
Maps vcs relative file path to path described by checkout rules.- Parameters:
path- to map- Returns:
- mapped path or null if path should be skipped.
-
isIncludeAll
public boolean isIncludeAll()
- Returns:
- true if the current checkout rules include all paths (even though some of the paths are remapped)
-
includesAny
public boolean includesAny(@NotNull Collection<String> paths)Returns true if these checkout rules include at least one of the specified paths.- Parameters:
paths- paths to check- Returns:
- see above
- Since:
- 2020.1.2
-
shouldInclude
public boolean shouldInclude(String path)
- Overrides:
shouldIncludein classFileRuleSet<IncludeRule,FileRule>
-
shouldInclude
public boolean shouldInclude(String path, Map<String,String> props)
- Overrides:
shouldIncludein classFileRuleSet<IncludeRule,FileRule>
-
shouldInclude
protected boolean shouldInclude(String path, @NotNull Filter<FileRule> includeExcludeRulesFilter)
- Overrides:
shouldIncludein classFileRuleSet<IncludeRule,FileRule>
-
shouldInclude
public boolean shouldInclude(String path, @NotNull IncludeRule rule)
- Overrides:
shouldIncludein classFileRuleSet<IncludeRule,FileRule>
-
createCommonRule
@NotNull public static CheckoutRules createCommonRule(@NotNull List<CheckoutRules> ruleses)
Creates 'union' rule- Parameters:
ruleses- given rule set.- Returns:
- union rule.
-
getAsString
@NotNull public String getAsString()
- Returns:
- checkout rule set string presentation.
-
isCorrect
public static boolean isCorrect(@NotNull String line)Returns true if line represents syntactically correct include or exclude rule. Note that empty line is considered correct.- Parameters:
line- include or exclude rule- Returns:
- true if line is correct
-
getRootIncludeRules
public List<IncludeRule> getRootIncludeRules()
Returns include rules sorted by from part. Some include rules may be omitted if they are completely included by other rules.- Returns:
- all include rules.
-
createNewRulesForPrefix
@NotNull public CheckoutRules createNewRulesForPrefix(@NotNull String prefixPath)
Creates new checkout rule set with prefix appended to every rule right part.- Parameters:
prefixPath- specified prefix.- Returns:
- new rule set.
-
postProcessCreatedRules
protected void postProcessCreatedRules(List<IncludeRule> includeRules, List<FileRule> excludeRules)
- Overrides:
postProcessCreatedRulesin classFileRuleSet<IncludeRule,FileRule>
-
doPostInitProcess
protected void doPostInitProcess(@NotNull List<IncludeRule> includeRules, @NotNull List<FileRule> excludeRules)- Specified by:
doPostInitProcessin classFileRuleSet<IncludeRule,FileRule>
-
createNewIncludeRule
protected IncludeRule createNewIncludeRule(String rule)
- Specified by:
createNewIncludeRulein classFileRuleSet<IncludeRule,FileRule>
-
createNewExcludeRule
protected FileRule createNewExcludeRule(String line)
- Specified by:
createNewExcludeRulein classFileRuleSet<IncludeRule,FileRule>
-
createNewIncludeRule
protected IncludeRule createNewIncludeRule(IncludeRule includeRule)
- Specified by:
createNewIncludeRulein classFileRuleSet<IncludeRule,FileRule>
-
createNewExcludeRule
protected FileRule createNewExcludeRule(FileRule rule)
- Specified by:
createNewExcludeRulein classFileRuleSet<IncludeRule,FileRule>
-
createOn
public static CheckoutRules createOn(String ruleStr)
Creates new rule set on the specified rules string presentation.- Parameters:
ruleStr- specified rule set string presentation.- Returns:
- new rule set object.
-
containsWildcards
public boolean containsWildcards()
Checks if some rule from the set contains wildcards.- Returns:
trueif some rule from the set contains wildcard,falseotherwise.
-
-