当前位置: 首页>>代码示例>>Java>>正文


Java PatchSetApproval.isLegacySubmit方法代码示例

本文整理汇总了Java中com.google.gerrit.reviewdb.client.PatchSetApproval.isLegacySubmit方法的典型用法代码示例。如果您正苦于以下问题:Java PatchSetApproval.isLegacySubmit方法的具体用法?Java PatchSetApproval.isLegacySubmit怎么用?Java PatchSetApproval.isLegacySubmit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gerrit.reviewdb.client.PatchSetApproval的用法示例。


在下文中一共展示了PatchSetApproval.isLegacySubmit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scanLabels

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private Map<String, PatchSetApproval> scanLabels(ChangeContext ctx, Map<String, Short> approvals)
    throws OrmException, IOException {
  Map<String, PatchSetApproval> current = new HashMap<>();
  // We optimize here and only retrieve current when approvals provided
  if (!approvals.isEmpty()) {
    for (PatchSetApproval a :
        approvalsUtil.byPatchSetUser(
            ctx.getDb(),
            ctx.getNotes(),
            ctx.getUser(),
            priorPatchSetId,
            ctx.getAccountId(),
            ctx.getRevWalk(),
            ctx.getRepoView().getConfig())) {
      if (a.isLegacySubmit()) {
        continue;
      }

      LabelType lt = projectState.getLabelTypes().byLabel(a.getLabelId());
      if (lt != null) {
        current.put(lt.getName(), a);
      }
    }
  }
  return current;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:ReplaceOp.java

示例2: parseStatus

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private Change.Status parseStatus(ChangeNotesCommit commit) throws ConfigInvalidException {
  List<String> statusLines = commit.getFooterLineValues(FOOTER_STATUS);
  if (statusLines.isEmpty()) {
    return null;
  } else if (statusLines.size() > 1) {
    throw expectedOneFooter(FOOTER_STATUS, statusLines);
  }
  Change.Status status =
      Enums.getIfPresent(Change.Status.class, statusLines.get(0).toUpperCase()).orNull();
  if (status == null) {
    throw invalidFooter(FOOTER_STATUS, statusLines.get(0));
  }
  // All approvals after MERGED and before the next status change get the postSubmit
  // bit. (Currently the state can't change from MERGED to something else, but just in case.) The
  // exception is the legacy SUBM approval, which is never considered post-submit, but might end
  // up sorted after the submit during rebuilding.
  if (status == Change.Status.MERGED) {
    for (PatchSetApproval psa : bufferedApprovals) {
      if (!psa.isLegacySubmit()) {
        psa.setPostSubmit(true);
      }
    }
  }
  bufferedApprovals.clear();
  return status;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:ChangeNotesParser.java

示例3: getLabels

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private static Iterable<String> getLabels(ChangeData cd, boolean owners) throws OrmException {
  Set<String> allApprovals = new HashSet<>();
  Set<String> distinctApprovals = new HashSet<>();
  for (PatchSetApproval a : cd.currentApprovals()) {
    if (a.getValue() != 0 && !a.isLegacySubmit()) {
      allApprovals.add(formatLabel(a.getLabel(), a.getValue(), a.getAccountId()));
      if (owners && cd.change().getOwner().equals(a.getAccountId())) {
        allApprovals.add(
            formatLabel(a.getLabel(), a.getValue(), ChangeQueryBuilder.OWNER_ACCOUNT_ID));
      }
      distinctApprovals.add(formatLabel(a.getLabel(), a.getValue()));
    }
  }
  allApprovals.addAll(distinctApprovals);
  return allApprovals;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:ChangeField.java

示例4: normalize

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
/**
 * @param notes change notes containing the given approvals.
 * @param user current user.
 * @param approvals list of approvals.
 * @return copies of approvals normalized to the defined ranges for the label type. Approvals for
 *     unknown labels are not included in the output.
 */
public Result normalize(
    ChangeNotes notes, CurrentUser user, Collection<PatchSetApproval> approvals)
    throws IOException {
  List<PatchSetApproval> unchanged = Lists.newArrayListWithCapacity(approvals.size());
  List<PatchSetApproval> updated = Lists.newArrayListWithCapacity(approvals.size());
  List<PatchSetApproval> deleted = Lists.newArrayListWithCapacity(approvals.size());
  LabelTypes labelTypes =
      projectCache.checkedGet(notes.getProjectName()).getLabelTypes(notes, user);
  for (PatchSetApproval psa : approvals) {
    Change.Id changeId = psa.getKey().getParentKey().getParentKey();
    checkArgument(
        changeId.equals(notes.getChangeId()),
        "Approval %s does not match change %s",
        psa.getKey(),
        notes.getChange().getKey());
    if (psa.isLegacySubmit()) {
      unchanged.add(psa);
      continue;
    }
    LabelType label = labelTypes.byLabel(psa.getLabelId());
    if (label == null) {
      deleted.add(psa);
      continue;
    }
    PatchSetApproval copy = copy(psa);
    applyTypeFloor(label, copy);
    if (copy.getValue() != psa.getValue()) {
      updated.add(copy);
    } else {
      unchanged.add(psa);
    }
  }
  return Result.create(unchanged, updated, deleted);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:42,代码来源:LabelNormalizer.java

示例5: scanLabels

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private Map<String, PatchSetApproval> scanLabels(
    ProjectState projectState, ChangeContext ctx, List<PatchSetApproval> del)
    throws OrmException, IOException {
  LabelTypes labelTypes = projectState.getLabelTypes(ctx.getNotes(), ctx.getUser());
  Map<String, PatchSetApproval> current = new HashMap<>();

  for (PatchSetApproval a :
      approvalsUtil.byPatchSetUser(
          ctx.getDb(),
          ctx.getNotes(),
          ctx.getUser(),
          psId,
          user.getAccountId(),
          ctx.getRevWalk(),
          ctx.getRepoView().getConfig())) {
    if (a.isLegacySubmit()) {
      continue;
    }

    LabelType lt = labelTypes.byLabel(a.getLabelId());
    if (lt != null) {
      current.put(lt.getName(), a);
    } else {
      del.add(a);
    }
  }
  return current;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:29,代码来源:PostReview.java

示例6: getSubmitter

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
public static PatchSetApproval getSubmitter(PatchSet.Id c, Iterable<PatchSetApproval> approvals) {
  if (c == null) {
    return null;
  }
  PatchSetApproval submitter = null;
  for (PatchSetApproval a : approvals) {
    if (a.getPatchSetId().equals(c) && a.getValue() > 0 && a.isLegacySubmit()) {
      if (submitter == null || a.getGranted().compareTo(submitter.getGranted()) > 0) {
        submitter = a;
      }
    }
  }
  return submitter;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:15,代码来源:ApprovalsUtil.java

示例7: diffPatchSetApprovals

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private static void diffPatchSetApprovals(
    List<String> diffs, ChangeBundle bundleA, ChangeBundle bundleB) {
  Map<PatchSetApproval.Key, PatchSetApproval> as = bundleA.filterPatchSetApprovals();
  Map<PatchSetApproval.Key, PatchSetApproval> bs = bundleB.filterPatchSetApprovals();
  for (PatchSetApproval.Key k : diffKeySets(diffs, as, bs)) {
    PatchSetApproval a = as.get(k);
    PatchSetApproval b = bs.get(k);
    String desc = describe(k);

    // ReviewDb allows timestamps before patch set was created, but NoteDb
    // truncates this to the patch set creation timestamp.
    //
    // ChangeRebuilder ensures all post-submit approvals happen after the
    // actual submit, so the timestamps may not line up. This shouldn't really
    // happen, because postSubmit shouldn't be set in ReviewDb until after the
    // change is submitted in ReviewDb, but you never know.
    //
    // Due to a quirk of PostReview, post-submit 0 votes might not have the
    // postSubmit bit set in ReviewDb. As these are only used for tombstone
    // purposes, ignore the postSubmit bit in NoteDb in this case.
    Timestamp ta = a.getGranted();
    Timestamp tb = b.getGranted();
    PatchSet psa = checkNotNull(bundleA.patchSets.get(a.getPatchSetId()));
    PatchSet psb = checkNotNull(bundleB.patchSets.get(b.getPatchSetId()));
    boolean excludeGranted = false;
    boolean excludePostSubmit = false;
    List<String> exclude = new ArrayList<>(1);
    if (bundleA.source == REVIEW_DB && bundleB.source == NOTE_DB) {
      excludeGranted =
          (ta.before(psa.getCreatedOn()) && tb.equals(psb.getCreatedOn()))
              || ta.compareTo(tb) < 0;
      excludePostSubmit = a.getValue() == 0 && b.isPostSubmit();
    } else if (bundleA.source == NOTE_DB && bundleB.source == REVIEW_DB) {
      excludeGranted =
          tb.before(psb.getCreatedOn()) && ta.equals(psa.getCreatedOn()) || tb.compareTo(ta) < 0;
      excludePostSubmit = b.getValue() == 0 && a.isPostSubmit();
    }

    // Legacy submit approvals may or may not have tags associated with them,
    // depending on whether ChangeRebuilder happened to group them with the
    // status change.
    boolean excludeTag =
        bundleA.source != bundleB.source && a.isLegacySubmit() && b.isLegacySubmit();

    if (excludeGranted) {
      exclude.add("granted");
    }
    if (excludePostSubmit) {
      exclude.add("postSubmit");
    }
    if (excludeTag) {
      exclude.add("tag");
    }

    diffColumnsExcluding(diffs, PatchSetApproval.class, desc, bundleA, a, bundleB, b, exclude);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:58,代码来源:ChangeBundle.java


注:本文中的com.google.gerrit.reviewdb.client.PatchSetApproval.isLegacySubmit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。