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 RepositoryState
apply(RepositoryState state)
Apply this spec to the given repository stateString
asString()
Returns a string representation of this branch spec.boolean
equals(Object obj)
String
getLogicalBranchName(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> T
getOption(Option<T> option)
Returns value of the specified option or its default value if such option is not specified in this specString
getVcsBranchName(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.int
hashCode()
boolean
isEmpty()
String
toString()
static void
validate(String spec)
static void
validate(String spec, boolean extendedSyntax)
static void
validate(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:BranchSpec
Apply this spec to the given repository state- Specified by:
apply
in 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:BranchSpec
Maps logical branch name to VCS branch name understandable by VCS plugin. Returns null if vcs branch name was not found.- Specified by:
getVcsBranchName
in 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:BranchSpec
Returns map of logical branch name to corresponding VCS branch name.- Specified by:
getVcsBranchNames
in 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:BranchSpec
Returns set of logical branch names for given state. This set doesn't include default branch name.- Specified by:
getLogicalBranchNames
in interfaceBranchSpec
- Parameters:
state
- repository state of interest- Returns:
- see above
-
getLogicalBranchName
@Nullable public String getLogicalBranchName(@NotNull String vcsBranchName)
Description copied from interface:BranchSpec
Returns a logical name for given vcs branch name or null if branch spec doesn't match given vcs branch- Specified by:
getLogicalBranchName
in interfaceBranchSpec
- Parameters:
vcsBranchName
- vcs branch name of interest- Returns:
- see above
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in 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:BranchSpec
Returns a string representation of this branch spec. Branch spec can be re-created from string representation usingBranchSpecs#parse(String)
- Specified by:
asString
in interfaceBranchSpec
- Returns:
- see above
-
getOption
@NotNull public <T> T getOption(@NotNull Option<T> option)
Description copied from interface:BranchSpec
Returns value of the specified option or its default value if such option is not specified in this spec- Specified by:
getOption
in interfaceBranchSpec
- Parameters:
option
- option of interest- Returns:
- see above
-
-