• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RevisionResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gerrit.server.change.RevisionResource的典型用法代码示例。如果您正苦于以下问题:Java RevisionResource类的具体用法?Java RevisionResource怎么用?Java RevisionResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RevisionResource类属于com.google.gerrit.server.change包,在下文中一共展示了RevisionResource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: apply

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Map<String, VerificationInfo> apply(RevisionResource rsrc)
    throws IOException, OrmException {
  Map<String, VerificationInfo> out = Maps.newHashMap();
  try (CiDb db = schemaFactory.open()) {
    for (PatchSetVerification v : db.patchSetVerifications()
        .byPatchSet(rsrc.getPatchSet().getId())) {
      VerificationInfo info = new VerificationInfo();
      info.value = v.getValue();
      info.url = v.getUrl();
      info.verifier = v.getVerifier();
      info.comment = v.getComment();
      out.put(v.getLabelId().get(), info);
    }
  }
  return out;
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:18,代码来源:GetVerifications.java


示例2: apply

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Response<?> apply(RevisionResource revision, VerifyInput input)
    throws AuthException, BadRequestException, UnprocessableEntityException,
    OrmException, IOException {
  if (input.verifications == null) {
    throw new BadRequestException("Missing verifications field");
  }

  try (CiDb db = schemaFactory.open()) {
    // Only needed for Google Megastore (that we don't use yet)
    db.patchSetVerifications().beginTransaction(null);
    boolean dirty = false;
    try {
      dirty |= updateLabels(revision, db, input.verifications);
      if (dirty) {
        db.commit();
      }
    } finally {
      db.rollback();
    }
  }
  return Response.none();
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:24,代码来源:PostVerification.java


示例3: run

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
protected final void run() throws UnloggedFailure {
  try {
    RevisionResource revision =
        revisions.parse(
            changes.parse(TopLevelResource.INSTANCE, IdString.fromUrl(changeId)),
            IdString.fromUrl("current"));
    if (useStdin) {
      ByteBuffer buf = IO.readWholeStream(in, 4096);
      input.rule = RawParseUtils.decode(buf.array(), buf.arrayOffset(), buf.limit());
    }
    Object result = createView().apply(revision, input);
    OutputFormat.JSON.newGson().toJson(result, stdout);
    stdout.print('\n');
  } catch (Exception e) {
    throw die("Processing of prolog script failed: " + e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:19,代码来源:BaseTestPrologCommand.java


示例4: commentBeforeFirstPatchSet

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Test
public void commentBeforeFirstPatchSet() throws Exception {
  PushOneCommit.Result r = createChange();
  PatchSet.Id psId = r.getPatchSetId();
  Change.Id id = psId.getParentKey();

  Change c = db.changes().get(id);
  c.setCreatedOn(new Timestamp(c.getCreatedOn().getTime() - 5000));
  db.changes().update(Collections.singleton(c));
  indexer.index(db, project, id);

  ReviewInput rin = new ReviewInput();
  rin.message = "comment";

  Timestamp ts = new Timestamp(c.getCreatedOn().getTime() + 2000);
  assertThat(ts).isGreaterThan(c.getCreatedOn());
  assertThat(ts).isLessThan(db.patchSets().get(psId).getCreatedOn());
  RevisionResource revRsrc = parseCurrentRevisionResource(r.getChangeId());
  postReview.get().apply(batchUpdateFactory, revRsrc, rin, ts);

  checker.rebuildAndCheckChanges(id);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ChangeRebuilderIT.java


示例5: commentPredatingChangeBySomeoneOtherThanOwner

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Test
public void commentPredatingChangeBySomeoneOtherThanOwner() throws Exception {
  PushOneCommit.Result r = createChange();
  PatchSet.Id psId = r.getPatchSetId();
  Change.Id id = psId.getParentKey();
  Change c = db.changes().get(id);

  ReviewInput rin = new ReviewInput();
  rin.message = "comment";

  Timestamp ts = new Timestamp(c.getCreatedOn().getTime() - 10000);
  RevisionResource revRsrc = parseCurrentRevisionResource(r.getChangeId());
  setApiUser(user);
  postReview.get().apply(batchUpdateFactory, revRsrc, rin, ts);

  checker.rebuildAndCheckChanges(id);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ChangeRebuilderIT.java


示例6: apply

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public String apply(RevisionResource rrsc) throws AuthException, BadRequestException, ResourceConflictException,
Exception {
  PatchSetCreatedEvent event = new PatchSetCreatedEvent();

  ChangeAttribute change = eventFactory.asChangeAttribute(rrsc.getChange());
  PatchSetAttribute patchSet = eventFactory.asPatchSetAttribute(rrsc.getPatchSet());
  AccountAttribute uploader = eventFactory.asAccountAttribute(reviewDb.accounts().get(rrsc.getPatchSet().getUploader()));

  event.change = change;
  event.patchSet = patchSet;
  event.uploader = uploader;

  changeHooks.postEvent(rrsc.getChange(), event, reviewDb);

  return "Triggered.";
}
 
开发者ID:rinrinne,项目名称:gerrit-change-trigger,代码行数:18,代码来源:ChangeTriggerAction.java


示例7: applyVerification

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
private void applyVerification(PatchSet patchSet, VerifyInput verify)
    throws RestApiException, NoSuchChangeException, OrmException,
    IOException {
  ChangeControl ctl =
      genericFactory.validateFor(db, patchSet.getId().getParentKey(),
          currentUser);
  ChangeResource changeResource = new ChangeResource(ctl);
  RevisionResource revResource = new RevisionResource(changeResource,
      patchSet);
  postVerification.apply(revResource, verify);
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:12,代码来源:VerifyCommand.java


示例8: scanLabels

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
private Map<String, PatchSetVerification> scanLabels(
    RevisionResource resource, CiDb db)
    throws OrmException {
  Map<String, PatchSetVerification> current = Maps.newHashMap();
  for (PatchSetVerification v : db.patchSetVerifications()
      .byPatchSet(resource.getPatchSet().getId())) {
    current.put(v.getLabelId().get(), v);
  }
  return current;
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:11,代码来源:PostVerification.java


示例9: getGroups

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
public static List<String> getGroups(RevisionResource rsrc) {
  if (rsrc.getEdit().isPresent()) {
    // Groups for an edit are just the base revision's groups, since they have
    // the same parent.
    return rsrc.getEdit().get().getBasePatchSet().getGroups();
  }
  return rsrc.getPatchSet().getGroups();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:GroupCollector.java


示例10: assertSubmittable

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
protected void assertSubmittable(String changeId) throws Exception {
  assertThat(get(changeId, SUBMITTABLE).submittable)
      .named("submit bit on ChangeInfo")
      .isEqualTo(true);
  RevisionResource rsrc = parseCurrentRevisionResource(changeId);
  UiAction.Description desc = submitHandler.getDescription(rsrc);
  assertThat(desc.isVisible()).named("visible bit on submit action").isTrue();
  assertThat(desc.isEnabled()).named("enabled bit on submit action").isTrue();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:AbstractSubmit.java


示例11: insertCommentsWithHistoricTimestamp

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Test
public void insertCommentsWithHistoricTimestamp() throws Exception {
  Timestamp timestamp = new Timestamp(0);
  for (Integer line : lines) {
    String file = "file";
    String contents = "contents " + line;
    PushOneCommit push =
        pushFactory.create(db, admin.getIdent(), testRepo, "first subject", file, contents);
    PushOneCommit.Result r = push.to("refs/for/master");
    String changeId = r.getChangeId();
    String revId = r.getCommit().getName();
    Timestamp origLastUpdated = r.getChange().change().getLastUpdatedOn();

    ReviewInput input = new ReviewInput();
    CommentInput comment = newComment(file, Side.REVISION, line, "comment 1", false);
    comment.updated = timestamp;
    input.comments = new HashMap<>();
    input.comments.put(comment.path, Lists.newArrayList(comment));
    ChangeResource changeRsrc =
        changes.get().parse(TopLevelResource.INSTANCE, IdString.fromDecoded(changeId));
    RevisionResource revRsrc = revisions.parse(changeRsrc, IdString.fromDecoded(revId));
    postReview.get().apply(batchUpdateFactory, revRsrc, input, timestamp);
    Map<String, List<CommentInfo>> result = getPublishedComments(changeId, revId);
    assertThat(result).isNotEmpty();
    CommentInfo actual = Iterables.getOnlyElement(result.get(comment.path));
    CommentInput ci = infoToInput(file).apply(actual);
    ci.updated = comment.updated;
    assertThat(comment).isEqualTo(ci);
    assertThat(actual.updated).isEqualTo(gApi.changes().id(r.getChangeId()).info().created);

    // Updating historic comments doesn't cause lastUpdatedOn to regress.
    assertThat(r.getChange().change().getLastUpdatedOn()).isEqualTo(origLastUpdated);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:35,代码来源:CommentsIT.java


示例12: apply

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Void apply(RevisionResource revision, PatchCoverageInput input)
        throws AuthException, BadRequestException, ResourceConflictException,
        UnprocessableEntityException, OrmException, IOException {
    coverageDb.registerCoverage(revision, input);
    return null;
}
 
开发者ID:Ullink,项目名称:gerrit-coverage-plugin,代码行数:8,代码来源:PostPatchCoverage.java


示例13: apply

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Object apply(RevisionResource rsrc, Input input)
    throws ResourceConflictException, OrmException {
  Change change = rsrc.getChange();
  if (change.getStatus() != Status.WORKINPROGRESS) {
    throw new ResourceConflictException("change is " + status(change));
  }

  if (!change.currentPatchSetId().equals(rsrc.getPatchSet().getId())) {
    throw new ResourceConflictException("not current patch set");
  }

  changeStatus(change, input, Status.WORKINPROGRESS, Status.NEW);
  return Response.none();
}
 
开发者ID:davido,项目名称:gerrit-wip-plugin,代码行数:16,代码来源:ReadyForReviewAction.java


示例14: getDescription

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Description getDescription(RevisionResource rsrc) {
  PatchSet.Id current = rsrc.getChange().currentPatchSetId();
  return new Description()
      .setLabel("Ready")
      .setTitle("Set Ready For Review")
      .setVisible(rsrc.getChange().getStatus() == Status.WORKINPROGRESS
         && rsrc.getPatchSet().getId().equals(current));
}
 
开发者ID:davido,项目名称:gerrit-wip-plugin,代码行数:10,代码来源:ReadyForReviewAction.java


示例15: mark

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
private void mark(PatchSet patchSet) throws NoSuchChangeException,
    ResourceConflictException, OrmException {
  RevisionResource rsrc = new RevisionResource(
      new ChangeResource(changeControlFactory
          .controlFor(patchSet.getId().getParentKey())), patchSet);
  BaseAction.Input input = new BaseAction.Input();
  input.message = changeComment;
  if (wipChange) {
    wipProvider.get().apply(rsrc, input);
  } else {
    readyProvider.get().apply(rsrc, input);
  }
}
 
开发者ID:davido,项目名称:gerrit-wip-plugin,代码行数:14,代码来源:SetCommand.java


示例16: apply

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Object apply(RevisionResource rsrc, Input input)
    throws ResourceConflictException, OrmException {
  Change change = rsrc.getChange();
  if (change.getStatus() != Status.NEW) {
    throw new ResourceConflictException("change is " + status(change));
  }

  if (!change.currentPatchSetId().equals(rsrc.getPatchSet().getId())) {
    throw new ResourceConflictException("not current patch set");
  }

  changeStatus(change, input, Status.NEW, Status.WORKINPROGRESS);
  return Response.none();
}
 
开发者ID:davido,项目名称:gerrit-wip-plugin,代码行数:16,代码来源:WorkInProgressAction.java


示例17: getDescription

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
@Override
public Description getDescription(RevisionResource rsrc) {
  PatchSet.Id current = rsrc.getChange().currentPatchSetId();
  return new Description()
      .setLabel("WIP")
      .setTitle("Set Work In Progress")
      .setVisible(rsrc.getChange().getStatus() == Status.NEW
         && rsrc.getPatchSet().getId().equals(current));
}
 
开发者ID:davido,项目名称:gerrit-wip-plugin,代码行数:10,代码来源:WorkInProgressAction.java


示例18: updateLabels

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
private boolean updateLabels(RevisionResource resource, CiDb db,
    Map<String, VerificationInfo> jobs)
    throws OrmException, BadRequestException {
  Preconditions.checkNotNull(jobs);

  List<PatchSetVerification> ups = Lists.newArrayList();
  Map<String, PatchSetVerification> current = scanLabels(resource, db);

  Timestamp ts = TimeUtil.nowTs();
  for (Map.Entry<String, VerificationInfo> ent : jobs.entrySet()) {
    String name = ent.getKey();
    PatchSetVerification c = current.remove(name);
    Short value = ent.getValue().value;
    if (value == null) {
      throw new BadRequestException("Missing value field");
    }
    if (c != null) {
      c.setGranted(ts);
      c.setValue(value);
      String url = ent.getValue().url;
      if (url != null) {
        c.setUrl(url);
      }
      String verifier = ent.getValue().verifier;
      if (verifier != null) {
        c.setVerifier(verifier);
      }
      String comment = ent.getValue().comment;
      if (comment != null) {
        c.setComment(comment);
      }
      log.info("Updating job " + c.getLabel() + " for change "
          + c.getPatchSetId());
      ups.add(c);
    } else {
      c = new PatchSetVerification(new PatchSetVerification.Key(
              resource.getPatchSet().getId(),
              new LabelId(name)),
          value, TimeUtil.nowTs());
      c.setGranted(ts);
      c.setUrl(ent.getValue().url);
      c.setVerifier(ent.getValue().verifier);
      c.setComment(ent.getValue().comment);
      log.info("Adding job " + c.getLabel() + " for change "
          + c.getPatchSetId());
      ups.add(c);
    }
  }

  db.patchSetVerifications().upsert(ups);
  return !ups.isEmpty();
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:53,代码来源:PostVerification.java


示例19: parseCurrentRevisionResource

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
protected RevisionResource parseCurrentRevisionResource(String changeId) throws Exception {
  ChangeResource cr = parseChangeResource(changeId);
  int psId = cr.getChange().currentPatchSetId().get();
  return revisions.parse(cr, IdString.fromDecoded(Integer.toString(psId)));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:AbstractDaemonTest.java


示例20: parseRevisionResource

import com.google.gerrit.server.change.RevisionResource; //导入依赖的package包/类
protected RevisionResource parseRevisionResource(String changeId, int n) throws Exception {
  return revisions.parse(
      parseChangeResource(changeId), IdString.fromDecoded(Integer.toString(n)));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:AbstractDaemonTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Utilities类代码示例发布时间:2022-05-23
下一篇:
Java VarExporter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap