private boolean matchesBranch()

in rest-api/src/jetbrains/buildServer/server/rest/data/BranchMatcher.java [88:121]


  private boolean matchesBranch(@Nullable final Branch buildBranch) {
    if (myLocator == null){
      return true; //buildBranch == null || buildBranch.isDefaultBranch();
    }
    if (mySingleValue != null) {//treat as logic branch name with special values
      return matchesBranchName(mySingleValue, buildBranch);
    }

    if (myDefaultBranch != null) {
      if (buildBranch != null && !myDefaultBranch.equals(buildBranch.isDefaultBranch())) {
        return false;
      }
      if (buildBranch == null && !myDefaultBranch) { //making default:true match not-branched builds
        return false;
      }
    }
    if (myUnspecifiedBranch != null) {
      if (buildBranch != null && !myUnspecifiedBranch.equals(Branch.UNSPECIFIED_BRANCH_NAME.equals(buildBranch.getName()))) {
        return false;
      }
      if (buildBranch == null && myUnspecifiedBranch) {
        return false;
      }
    }
    if (myBranchName != null && !matchesBranchName(myBranchName, buildBranch)) {
      return false;
    }
    if (myBranched != null) {
      if (!myBranched.equals(buildBranch != null)) {
        return false;
      }
    }
    return true;
  }