Merge changes I40991952,Ibcbb59cf,I8c34a759

* changes:
  PatchLineCommentsUtil#setCommentRevId(...): Remove unused return value
  Remove changeId from RevisionNoteData.CommentKey
  Remove status from RevisionNoteData.Comment
This commit is contained in:
ekempin 2016-09-21 09:00:55 +00:00 committed by Gerrit Code Review
commit e0b413a170
3 changed files with 11 additions and 19 deletions

View File

@ -348,7 +348,7 @@ public class PatchLineCommentsUtil {
return sort(result);
}
public static RevId setCommentRevId(PatchLineComment c,
public static void setCommentRevId(PatchLineComment c,
PatchListCache cache, Change change, PatchSet ps) throws OrmException {
checkArgument(c.getPatchSetId().equals(ps.getId()),
"cannot set RevId for patch set %s on comment %s", ps.getId(), c);
@ -369,7 +369,6 @@ public class PatchLineCommentsUtil {
throw new OrmException(e);
}
}
return c.getRevId();
}
public Collection<Ref> getDraftRefs(Change.Id changeId)

View File

@ -83,7 +83,7 @@ class RevisionNote {
if (isJson(raw, p.value)) {
RevisionNoteData data = parseJson(noteUtil, p.value);
comments = data.exportComments(status);
comments = data.exportComments(changeId, status);
if (status == PatchLineComment.Status.PUBLISHED) {
pushCert = data.pushCert;
} else {

View File

@ -48,19 +48,17 @@ class RevisionNoteData {
String uuid;
String filename;
int patchSetId;
int changeId;
CommentKey(PatchLineComment.Key k) {
uuid = k.get();
filename = k.getParentKey().getFileName();
patchSetId = k.getParentKey().getParentKey().get();
changeId = k.getParentKey().getParentKey().getParentKey().get();
}
PatchLineComment.Key export() {
PatchLineComment.Key export(Change.Id changeId) {
return new PatchLineComment.Key(
new Patch.Key(
new PatchSet.Id(new Change.Id(changeId), patchSetId),
new PatchSet.Id(changeId, patchSetId),
filename),
uuid);
}
@ -90,7 +88,6 @@ class RevisionNoteData {
int lineNbr;
Identity author;
Timestamp writtenOn;
char status;
short side;
String message;
String parentUuid;
@ -104,7 +101,6 @@ class RevisionNoteData {
lineNbr = plc.getLine();
author = new Identity(plc.getAuthor());
writtenOn = plc.getWrittenOn();
status = plc.getStatus().getCode();
side = plc.getSide();
message = plc.getMessage();
parentUuid = plc.getParentUuid();
@ -114,17 +110,18 @@ class RevisionNoteData {
this.serverId = serverId;
}
PatchLineComment export() {
PatchLineComment export(Change.Id changeId,
PatchLineComment.Status status) {
PatchLineComment plc = new PatchLineComment(
key.export(), lineNbr, author.export(), parentUuid, writtenOn);
key.export(changeId), lineNbr, author.export(), parentUuid, writtenOn);
plc.setSide(side);
plc.setStatus(PatchLineComment.Status.forCode(status));
plc.setMessage(message);
if (range != null) {
plc.setRange(range.export());
}
plc.setTag(tag);
plc.setRevId(new RevId(revId));
plc.setStatus(status);
return plc;
}
}
@ -133,16 +130,12 @@ class RevisionNoteData {
String pushCert;
List<Comment> comments;
ImmutableList<PatchLineComment> exportComments(
ImmutableList<PatchLineComment> exportComments(Change.Id changeId,
PatchLineComment.Status status) {
return ImmutableList.copyOf(
comments.stream()
.map(
c -> {
PatchLineComment plc = c.export();
plc.setStatus(status);
return plc;
})
.map(c -> c.export(changeId, status))
.collect(toList()));
}
}