Class BranchSpec

All Implemented Interfaces:
Describable<BranchSpec>, Serializable

@ExportedBean public class BranchSpec extends AbstractDescribableImpl<BranchSpec> implements Serializable
A specification of branches to build. Rather like a refspec. eg:
 master
 origin/master
 origin/*
 origin/*/thing
 
See Also:
  • Constructor Details

    • BranchSpec

      @DataBoundConstructor public BranchSpec(String name)
  • Method Details

    • getName

      @Exported public String getName()
    • setName

      public void setName(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • matches

      public boolean matches(String item)
    • matches

      public boolean matches(String ref, EnvVars env)
      Compare a git branch reference to configured pattern.

      reference uses normalized format `ref/(heads|tags)/xx` pattern do support

      • ref/heads/branch
      • (remote-name)?/branch
      • ref/remotes/branch
      • tag
      • (commit sha1)
      Parameters:
      ref - branch reference to compare
      env - environment variables to use in comparison
      Returns:
      true if ref matches configured pattern
    • matchesRepositoryBranch

      public boolean matchesRepositoryBranch(String repositoryName, String branchName)
      Compare the configured pattern to a git branch defined by the repository name and branch name.
      Parameters:
      repositoryName - git repository name
      branchName - git branch name
      Returns:
      true if repositoryName/branchName matches this BranchSpec
    • filterMatching

      @Deprecated public List<String> filterMatching(Collection<String> branches)
      Parameters:
      branches - source branch list to be filtered by configured branch specification using a newly constructed EnvVars
      Returns:
      branch names which match
    • filterMatching

      public List<String> filterMatching(Collection<String> branches, EnvVars env)
    • filterMatchingBranches

      public List<hudson.plugins.git.Branch> filterMatchingBranches(Collection<hudson.plugins.git.Branch> branches)
    • filterMatchingBranches

      public List<hudson.plugins.git.Branch> filterMatchingBranches(Collection<hudson.plugins.git.Branch> branches, EnvVars env)