當前位置: 首頁>>代碼示例>>Java>>正文


Java RevId類代碼示例

本文整理匯總了Java中com.google.gerrit.reviewdb.client.RevId的典型用法代碼示例。如果您正苦於以下問題:Java RevId類的具體用法?Java RevId怎麽用?Java RevId使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RevId類屬於com.google.gerrit.reviewdb.client包,在下文中一共展示了RevId類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onLoad

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
@Override
protected void onLoad(LoadHandle handle) throws IOException, ConfigInvalidException {
  metaId = handle.id();
  if (metaId == null) {
    loadDefaults();
    return;
  }
  metaId = metaId.copy();

  RevCommit tipCommit = handle.walk().parseCommit(metaId);
  ObjectReader reader = handle.walk().getObjectReader();
  revisionNoteMap =
      RevisionNoteMap.parseRobotComments(args.noteUtil, reader, NoteMap.read(reader, tipCommit));
  ListMultimap<RevId, RobotComment> cs = MultimapBuilder.hashKeys().arrayListValues().build();
  for (RobotCommentsRevisionNote rn : revisionNoteMap.revisionNotes.values()) {
    for (RobotComment c : rn.getComments()) {
      cs.put(new RevId(c.revId), c);
    }
  }
  comments = ImmutableListMultimap.copyOf(cs);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:22,代碼來源:RobotCommentNotes.java

示例2: onLoad

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
@Override
protected void onLoad(LoadHandle handle) throws IOException, ConfigInvalidException {
  ObjectId rev = handle.id();
  if (rev == null) {
    loadDefaults();
    return;
  }

  RevCommit tipCommit = handle.walk().parseCommit(rev);
  ObjectReader reader = handle.walk().getObjectReader();
  revisionNoteMap =
      RevisionNoteMap.parse(
          args.noteUtil,
          getChangeId(),
          reader,
          NoteMap.read(reader, tipCommit),
          PatchLineComment.Status.DRAFT);
  ListMultimap<RevId, Comment> cs = MultimapBuilder.hashKeys().arrayListValues().build();
  for (ChangeRevisionNote rn : revisionNoteMap.revisionNotes.values()) {
    for (Comment c : rn.getComments()) {
      cs.put(new RevId(c.revId), c);
    }
  }
  comments = ImmutableListMultimap.copyOf(cs);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:26,代碼來源:DraftCommentNotes.java

示例3: parseNotes

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
private void parseNotes() throws IOException, ConfigInvalidException {
  ObjectReader reader = walk.getObjectReader();
  ChangeNotesCommit tipCommit = walk.parseCommit(tip);
  revisionNoteMap =
      RevisionNoteMap.parse(
          noteUtil,
          id,
          reader,
          NoteMap.read(reader, tipCommit),
          PatchLineComment.Status.PUBLISHED);
  Map<RevId, ChangeRevisionNote> rns = revisionNoteMap.revisionNotes;

  for (Map.Entry<RevId, ChangeRevisionNote> e : rns.entrySet()) {
    for (Comment c : e.getValue().getComments()) {
      comments.put(e.getKey(), c);
    }
  }

  for (PatchSet ps : patchSets.values()) {
    ChangeRevisionNote rn = rns.get(ps.getRevision());
    if (rn != null && rn.getPushCert() != null) {
      ps.setPushCertificate(rn.getPushCert());
    }
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:26,代碼來源:ChangeNotesParser.java

示例4: parse

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
static RevisionNoteMap<ChangeRevisionNote> parse(
    ChangeNoteUtil noteUtil,
    Change.Id changeId,
    ObjectReader reader,
    NoteMap noteMap,
    PatchLineComment.Status status)
    throws ConfigInvalidException, IOException {
  Map<RevId, ChangeRevisionNote> result = new HashMap<>();
  for (Note note : noteMap) {
    ChangeRevisionNote rn =
        new ChangeRevisionNote(noteUtil, changeId, reader, note.getData(), status);
    rn.parse();
    result.put(new RevId(note.name()), rn);
  }
  return new RevisionNoteMap<>(noteMap, ImmutableMap.copyOf(result));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:17,代碼來源:RevisionNoteMap.java

示例5: find

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
private List<RevisionResource> find(ChangeResource change, String id)
    throws OrmException, IOException, AuthException {
  if (id.equals("0") || id.equals("edit")) {
    return loadEdit(change, null);
  } else if (id.length() < 6 && id.matches("^[1-9][0-9]{0,4}$")) {
    // Legacy patch set number syntax.
    return byLegacyPatchSetId(change, id);
  } else if (id.length() < 4 || id.length() > RevId.LEN) {
    // Require a minimum of 4 digits.
    // Impossibly long identifier will never match.
    return Collections.emptyList();
  } else {
    List<RevisionResource> out = new ArrayList<>();
    for (PatchSet ps : psUtil.byChange(dbProvider.get(), change.getNotes())) {
      if (ps.getRevision() != null && ps.getRevision().get().startsWith(id)) {
        out.add(new RevisionResource(change, ps));
      }
    }
    // Not an existing patch set on a change, but might be an edit.
    if (out.isEmpty() && id.length() == RevId.LEN) {
      return loadEdit(change, new RevId(id));
    }
    return out;
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:26,代碼來源:Revisions.java

示例6: diffPatchSetIdSets

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
@Test
public void diffPatchSetIdSets() throws Exception {
  Change c = TestChanges.newChange(project, accountId);
  TestChanges.incrementPatchSet(c);

  PatchSet ps1 = new PatchSet(new PatchSet.Id(c.getId(), 1));
  ps1.setRevision(new RevId("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));
  ps1.setUploader(accountId);
  ps1.setCreatedOn(TimeUtil.nowTs());
  PatchSet ps2 = new PatchSet(new PatchSet.Id(c.getId(), 2));
  ps2.setRevision(new RevId("badc0feebadc0feebadc0feebadc0feebadc0fee"));
  ps2.setUploader(accountId);
  ps2.setCreatedOn(TimeUtil.nowTs());

  ChangeBundle b1 =
      new ChangeBundle(
          c, messages(), patchSets(ps2), approvals(), comments(), reviewers(), REVIEW_DB);
  ChangeBundle b2 =
      new ChangeBundle(
          c, messages(), patchSets(ps1, ps2), approvals(), comments(), reviewers(), REVIEW_DB);

  assertDiffs(b1, b2, "PatchSet.Id sets differ: [] only in A; [" + c.getId() + ",1] only in B");
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:24,代碼來源:ChangeBundleTest.java

示例7: toParentInfos

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
private List<PatchSetInfo.ParentInfo> toParentInfos(RevCommit[] parents, RevWalk walk)
    throws IOException, MissingObjectException {
  List<PatchSetInfo.ParentInfo> pInfos = new ArrayList<>(parents.length);
  for (RevCommit parent : parents) {
    walk.parseBody(parent);
    RevId rev = new RevId(parent.getId().name());
    String msg = parent.getShortMessage();
    pInfos.add(new PatchSetInfo.ParentInfo(rev, msg));
  }
  return pInfos;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:12,代碼來源:PatchSetInfoFactory.java

示例8: insert

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
public PatchSet insert(
    ReviewDb db,
    RevWalk rw,
    ChangeUpdate update,
    PatchSet.Id psId,
    ObjectId commit,
    List<String> groups,
    String pushCertificate,
    String description)
    throws OrmException, IOException {
  checkNotNull(groups, "groups may not be null");
  ensurePatchSetMatches(psId, update);

  PatchSet ps = new PatchSet(psId);
  ps.setRevision(new RevId(commit.name()));
  ps.setUploader(update.getAccountId());
  ps.setCreatedOn(new Timestamp(update.getWhen().getTime()));
  ps.setGroups(groups);
  ps.setPushCertificate(pushCertificate);
  ps.setDescription(description);
  db.patchSets().insert(Collections.singleton(ps));

  update.setCommit(rw, commit, pushCertificate);
  update.setPsDescription(description);
  update.setGroups(groups);

  return ps;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:29,代碼來源:PatchSetUtil.java

示例9: getDraftComments

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
public ImmutableListMultimap<RevId, Comment> getDraftComments(
    Account.Id author, @Nullable Ref ref) throws OrmException {
  loadDraftComments(author, ref);
  // Filter out any zombie draft comments. These are drafts that are also in
  // the published map, and arise when the update to All-Users to delete them
  // during the publish operation failed.
  return ImmutableListMultimap.copyOf(
      Multimaps.filterEntries(
          draftCommentNotes.getComments(), e -> !getCommentKeys().contains(e.getValue().key)));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:11,代碼來源:ChangeNotes.java

示例10: get

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
RevisionNoteBuilder get(RevId revId) {
  RevisionNoteBuilder b = builders.get(revId);
  if (b == null) {
    b = new RevisionNoteBuilder(revisionNoteMap.revisionNotes.get(revId));
    builders.put(revId, b);
  }
  return b;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:9,代碼來源:RevisionNoteBuilder.java

示例11: parseRobotComments

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
static RevisionNoteMap<RobotCommentsRevisionNote> parseRobotComments(
    ChangeNoteUtil noteUtil, ObjectReader reader, NoteMap noteMap)
    throws ConfigInvalidException, IOException {
  Map<RevId, RobotCommentsRevisionNote> result = new HashMap<>();
  for (Note note : noteMap) {
    RobotCommentsRevisionNote rn =
        new RobotCommentsRevisionNote(noteUtil, reader, note.getData());
    rn.parse();
    result.put(new RevId(note.name()), rn);
  }
  return new RevisionNoteMap<>(noteMap, ImmutableMap.copyOf(result));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:13,代碼來源:RevisionNoteMap.java

示例12: storeRevisionNotes

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
/** @return the tree id for the updated tree */
private ObjectId storeRevisionNotes(RevWalk rw, ObjectInserter inserter, ObjectId curr)
    throws ConfigInvalidException, OrmException, IOException {
  if (comments.isEmpty() && pushCert == null) {
    return null;
  }
  RevisionNoteMap<ChangeRevisionNote> rnm = getRevisionNoteMap(rw, curr);

  RevisionNoteBuilder.Cache cache = new RevisionNoteBuilder.Cache(rnm);
  for (Comment c : comments) {
    c.tag = tag;
    cache.get(new RevId(c.revId)).putComment(c);
  }
  if (pushCert != null) {
    checkState(commit != null);
    cache.get(new RevId(commit)).setPushCertificate(pushCert);
  }
  Map<RevId, RevisionNoteBuilder> builders = cache.getBuilders();
  checkComments(rnm.revisionNotes, builders);

  for (Map.Entry<RevId, RevisionNoteBuilder> e : builders.entrySet()) {
    ObjectId data =
        inserter.insert(OBJ_BLOB, e.getValue().build(noteUtil, noteUtil.getWriteJson()));
    rnm.noteMap.set(ObjectId.fromString(e.getKey().get()), data);
  }

  return rnm.noteMap.writeTree(inserter);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:29,代碼來源:ChangeUpdate.java

示例13: loadEdit

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
private List<RevisionResource> loadEdit(ChangeResource change, RevId revid)
    throws AuthException, IOException {
  Optional<ChangeEdit> edit = editUtil.byChange(change.getNotes(), change.getUser());
  if (edit.isPresent()) {
    PatchSet ps = new PatchSet(new PatchSet.Id(change.getId(), 0));
    RevId editRevId = new RevId(ObjectId.toString(edit.get().getEditCommit()));
    ps.setRevision(editRevId);
    if (revid == null || editRevId.equals(revid)) {
      return Collections.singletonList(new RevisionResource(change, ps, edit));
    }
  }
  return Collections.emptyList();
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:14,代碼來源:Revisions.java

示例14: newPatchSet

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
public static PatchSet newPatchSet(PatchSet.Id id, String revision, Account.Id userId) {
  PatchSet ps = new PatchSet(id);
  ps.setRevision(new RevId(revision));
  ps.setUploader(userId);
  ps.setCreatedOn(TimeUtil.nowTs());
  return ps;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:8,代碼來源:TestChanges.java

示例15: tagInlineComments

import com.google.gerrit.reviewdb.client.RevId; //導入依賴的package包/類
@Test
public void tagInlineComments() throws Exception {
  String tag = "jenkins";
  Change c = newChange();
  RevCommit commit = tr.commit().message("PS2").create();
  ChangeUpdate update = newUpdate(c, changeOwner);
  update.putComment(
      Status.PUBLISHED,
      newComment(
          c.currentPatchSetId(),
          "a.txt",
          "uuid1",
          new CommentRange(1, 2, 3, 4),
          1,
          changeOwner,
          null,
          TimeUtil.nowTs(),
          "Comment",
          (short) 1,
          commit.name(),
          false));
  update.setTag(tag);
  update.commit();

  ChangeNotes notes = newNotes(c);

  ImmutableListMultimap<RevId, Comment> comments = notes.getComments();
  assertThat(comments).hasSize(1);
  assertThat(comments.entries().asList().get(0).getValue().tag).isEqualTo(tag);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:31,代碼來源:ChangeNotesTest.java


注:本文中的com.google.gerrit.reviewdb.client.RevId類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。