Interface BranchSpec

    • Field Detail

      • FALLBACK_TO_DEFAULT

        static final Option<Boolean> FALLBACK_TO_DEFAULT
        Whether the default branch revision should be used when no matching vcs branch found
      • ALLOW_DEFAULT_BRANCH

        static final Option<Boolean> ALLOW_DEFAULT_BRANCH
        Deprecated.
        since 2024.07
        Whether use of the default branch in VCS root is allowed even if it is disabled in the buildType
    • Method Detail

      • apply

        @NotNull
        RepositoryState apply​(@NotNull
                              RepositoryState state)
        Apply this spec to the given repository state
        Parameters:
        state - repository state of interest
        Returns:
        repository state containing only branches matched by this spec
      • getVcsBranchName

        @Nullable
        String getVcsBranchName​(@NotNull
                                RepositoryState state,
                                @NotNull
                                String logicalBranchName)
        Maps logical branch name to VCS branch name understandable by VCS plugin. Returns null if vcs branch name was not found.
        Parameters:
        state - repository state of interest
        logicalBranchName - logical branch name
        Returns:
        see above
      • getVcsBranchNames

        @NotNull
        Map<String,​String> getVcsBranchNames​(@NotNull
                                                   RepositoryState state,
                                                   @NotNull
                                                   Collection<String> logicalBranchNames)
        Returns map of logical branch name to corresponding VCS branch name.
        Parameters:
        state - repository state of interest
        logicalBranchNames - logical branch names
        Returns:
        see above
        Since:
        2020.1
      • getLogicalBranchNames

        @NotNull
        Set<String> getLogicalBranchNames​(@NotNull
                                          RepositoryState state)
        Returns set of logical branch names for given state. This set doesn't include default branch name.
        Parameters:
        state - repository state of interest
        Returns:
        see above
      • getLogicalBranchName

        @Nullable
        String getLogicalBranchName​(@NotNull
                                    String vcsBranchName)
        Returns a logical name for given vcs branch name or null if branch spec doesn't match given vcs branch
        Parameters:
        vcsBranchName - vcs branch name of interest
        Returns:
        see above
      • isEmpty

        boolean isEmpty()
        Returns:
        true if this branch spec is empty, i.e. does not include any branch
      • asString

        @NotNull
        String asString()
        Returns a string representation of this branch spec. Branch spec can be re-created from string representation using BranchSpecs#parse(String)
        Returns:
        see above
      • getOption

        @NotNull
        <T> T getOption​(@NotNull
                        Option<T> option)
        Returns value of the specified option or its default value if such option is not specified in this spec
        Parameters:
        option - option of interest
        Returns:
        see above
        Since:
        2017.1