static void applyCopyScoreRulesTo()

in src/main/java/com/googlesource/gerrit/plugins/simplesubmitrules/config/ConfigTranslator.java [82:101]


  static void applyCopyScoreRulesTo(
      Set<String> copyScoreRules, Set<String> disallowedCopyScoreRules, LabelType.Builder labelType)
      throws BadRequestException {
    Set<String> disallowed =
        Sets.intersection(ImmutableSet.copyOf(copyScoreRules), disallowedCopyScoreRules);
    if (!disallowed.isEmpty()) {
      throw new BadRequestException("copy score rules " + disallowed + " are forbidden");
    }

    labelType.setCopyMinScore(copyScoreRules.contains(ProjectConfig.KEY_COPY_MIN_SCORE));
    labelType.setCopyMaxScore(copyScoreRules.contains(ProjectConfig.KEY_COPY_MAX_SCORE));
    labelType.setCopyAllScoresIfNoChange(
        copyScoreRules.contains(ProjectConfig.KEY_COPY_ALL_SCORES_IF_NO_CHANGE));
    labelType.setCopyAllScoresIfNoCodeChange(
        copyScoreRules.contains(ProjectConfig.KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE));
    labelType.setCopyAllScoresOnMergeFirstParentUpdate(
        copyScoreRules.contains(ProjectConfig.KEY_COPY_ALL_SCORES_ON_MERGE_FIRST_PARENT_UPDATE));
    labelType.setCopyAllScoresOnTrivialRebase(
        copyScoreRules.contains(ProjectConfig.KEY_COPY_ALL_SCORES_ON_TRIVIAL_REBASE));
  }