@JavaScriptMethod
  public String checkBranch(String branch, String fork, String repo) {

    doFillBranchItems(repo, fork);

    if (branch.length() == 0) {
      return Messages.Branch_NoBranch();
    }

    // check if given branch is in branch list
    for (String b : this.branchItems) {
      if (b.equals(branch)) {
        return "__succeeded";
      }
    }

    return Messages.Branch_NotFound(branch);
  }
  /** Checks if given branch exists */
  public FormValidation checkDepBranch(
      @QueryParameter String value, @QueryParameter String name, @QueryParameter String fork)
      throws IOException, ServletException {

    doFillBranchItems(name, fork);

    if (value.length() == 0) {
      return FormValidation.error(Messages.Branch_NoBranch());
    }

    // check if given branch is in branch list
    for (String branch : this.branchItems) {
      if (branch.equals(value)) {
        return FormValidation.ok();
      }
    }

    return FormValidation.error(Messages.Branch_NotFound(value));
  }