Package jetbrains.buildServer.vcs.spec
Class PatternBranchSpec
- java.lang.Object
-
- jetbrains.buildServer.vcs.spec.PatternBranchSpec
-
- All Implemented Interfaces:
BranchSpec
public class PatternBranchSpec extends Object implements BranchSpec
Format:+|-:pattern
where pattern is a branch with an optional * placeholder and () brackets specify how to match vcs branch name to logical branch name.- Author:
- dmitry.neverov
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.vcs.BranchSpec
ALLOW_DEFAULT_BRANCH, FALLBACK_TO_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description PatternBranchSpec(String spec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RepositoryStateapply(RepositoryState state)Apply this spec to the given repository stateStringasString()Returns a string representation of this branch spec.booleanequals(Object obj)StringgetLogicalBranchName(String vcsBranchName)Returns a logical name for given vcs branch name or null if branch spec doesn't match given vcs branchSet<String>getLogicalBranchNames(RepositoryState state)Returns set of logical branch names for given state.<T> TgetOption(Option<T> option)Returns value of the specified option or its default value if such option is not specified in this specStringgetVcsBranchName(RepositoryState state, String logicalBranchName)Maps logical branch name to VCS branch name understandable by VCS plugin.Map<String,String>getVcsBranchNames(RepositoryState state, Collection<String> logicalBranchNames)Returns map of logical branch name to corresponding VCS branch name.inthashCode()booleanisEmpty()StringtoString()static voidvalidate(String spec)static voidvalidate(String spec, boolean extendedSyntax)static voidvalidate(String spec, boolean extendedSyntax, BranchAttributesFilterManager attributesFilterManager)
-
-
-
Constructor Detail
-
PatternBranchSpec
public PatternBranchSpec(@NotNull String spec) throws InvalidBranchSpecException- Throws:
InvalidBranchSpecException
-
-
Method Detail
-
validate
public static void validate(@Nullable String spec) throws InvalidBranchSpecException- Throws:
InvalidBranchSpecException
-
validate
public static void validate(@Nullable String spec, boolean extendedSyntax) throws InvalidBranchSpecException- Throws:
InvalidBranchSpecException
-
validate
public static void validate(@Nullable String spec, boolean extendedSyntax, @Nullable BranchAttributesFilterManager attributesFilterManager)- Parameters:
attributesFilterManager- if branch filter can contain attribute filters shoud be not null, othersise should be null
-
apply
@NotNull public RepositoryState apply(@NotNull RepositoryState state)
Description copied from interface:BranchSpecApply this spec to the given repository state- Specified by:
applyin interfaceBranchSpec- Parameters:
state- repository state of interest- Returns:
- repository state containing only branches matched by this spec
-
getVcsBranchName
@Nullable public String getVcsBranchName(@NotNull RepositoryState state, @NotNull String logicalBranchName)
Description copied from interface:BranchSpecMaps logical branch name to VCS branch name understandable by VCS plugin. Returns null if vcs branch name was not found.- Specified by:
getVcsBranchNamein interfaceBranchSpec- Parameters:
state- repository state of interestlogicalBranchName- logical branch name- Returns:
- see above
-
getVcsBranchNames
@NotNull public Map<String,String> getVcsBranchNames(@NotNull RepositoryState state, @NotNull Collection<String> logicalBranchNames)
Description copied from interface:BranchSpecReturns map of logical branch name to corresponding VCS branch name.- Specified by:
getVcsBranchNamesin interfaceBranchSpec- Parameters:
state- repository state of interestlogicalBranchNames- logical branch names- Returns:
- see above
-
getLogicalBranchNames
@NotNull public Set<String> getLogicalBranchNames(@NotNull RepositoryState state)
Description copied from interface:BranchSpecReturns set of logical branch names for given state. This set doesn't include default branch name.- Specified by:
getLogicalBranchNamesin interfaceBranchSpec- Parameters:
state- repository state of interest- Returns:
- see above
-
getLogicalBranchName
@Nullable public String getLogicalBranchName(@NotNull String vcsBranchName)
Description copied from interface:BranchSpecReturns a logical name for given vcs branch name or null if branch spec doesn't match given vcs branch- Specified by:
getLogicalBranchNamein interfaceBranchSpec- Parameters:
vcsBranchName- vcs branch name of interest- Returns:
- see above
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceBranchSpec- Returns:
- true if this branch spec is empty, i.e. does not include any branch
-
asString
@NotNull public String asString()
Description copied from interface:BranchSpecReturns a string representation of this branch spec. Branch spec can be re-created from string representation usingBranchSpecs#parse(String)- Specified by:
asStringin interfaceBranchSpec- Returns:
- see above
-
getOption
@NotNull public <T> T getOption(@NotNull Option<T> option)Description copied from interface:BranchSpecReturns value of the specified option or its default value if such option is not specified in this spec- Specified by:
getOptionin interfaceBranchSpec- Parameters:
option- option of interest- Returns:
- see above
-
-