Package jetbrains.buildServer.vcs.spec
Class DefaultBranchSpec
- java.lang.Object
-
- jetbrains.buildServer.vcs.spec.DefaultBranchSpec
-
- All Implemented Interfaces:
BranchSpec
public class DefaultBranchSpec extends Object implements BranchSpec
Default BranchSpec. Monitors only default branch. Does no mapping: real branch name for any logical branch name is the default 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 DefaultBranchSpec()
-
Method Summary
All 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()
-
-
-
Method Detail
-
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, @Nullable 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
-
-