Convert PatchSet.Id to AutoValue

See I6982fb24 for context.

Change-Id: I681421e2e3415125dc4db44c7f3bf32d37920166
This commit is contained in:
Dave Borowitz
2019-04-19 08:44:05 -07:00
parent 245af2a3f8
commit 766a93d2a0
86 changed files with 235 additions and 259 deletions

View File

@@ -147,7 +147,7 @@ public abstract class AbstractChangeUpdate {
}
public void setPatchSetId(PatchSet.Id psId) {
checkArgument(psId == null || psId.getParentKey().equals(getId()));
checkArgument(psId == null || psId.changeId().equals(getId()));
this.psId = psId;
}

View File

@@ -633,7 +633,7 @@ class ChangeNotesParser {
if (psId == null) {
throw invalidFooter(FOOTER_PATCH_SET, psIdStr);
}
return new PatchSet.Id(id, psId);
return PatchSet.id(id, psId);
}
private PatchSetState parsePatchSetState(ChangeNotesCommit commit) throws ConfigInvalidException {
@@ -689,8 +689,7 @@ class ChangeNotesParser {
}
ChangeMessage changeMessage =
new ChangeMessage(
ChangeMessage.key(psId.getParentKey(), commit.name()), accountId, ts, psId);
new ChangeMessage(ChangeMessage.key(psId.changeId(), commit.name()), accountId, ts, psId);
changeMessage.setMessage(changeMsgString.get());
changeMessage.setTag(tag);
changeMessage.setRealAuthor(realAccountId);
@@ -1031,7 +1030,7 @@ class ChangeNotesParser {
pruneEntitiesForMissingPatchSets(allChangeMessages, ChangeMessage::getPatchSetId, missing);
pruned +=
pruneEntitiesForMissingPatchSets(
comments.values(), c -> new PatchSet.Id(id, c.key.patchSetId), missing);
comments.values(), c -> PatchSet.id(id, c.key.patchSetId), missing);
pruned +=
pruneEntitiesForMissingPatchSets(
approvals.values(), PatchSetApproval::getPatchSetId, missing);

View File

@@ -601,7 +601,7 @@ public abstract class ChangeNotesState {
.owner(Account.id(proto.getOwner()))
.branch(proto.getBranch());
if (proto.getHasCurrentPatchSetId()) {
b.currentPatchSetId(new PatchSet.Id(changeId, proto.getCurrentPatchSetId()));
b.currentPatchSetId(PatchSet.id(changeId, proto.getCurrentPatchSetId()));
}
b.subject(proto.getSubject());
if (proto.getHasTopic()) {

View File

@@ -124,7 +124,7 @@ public class LegacyChangeNoteRead {
boolean isForBase,
Integer parentNumber)
throws ConfigInvalidException {
Change.Id changeId = psId.getParentKey();
Change.Id changeId = psId.changeId();
// Check if there is a new file.
boolean newFile =
@@ -285,7 +285,7 @@ public class LegacyChangeNoteRead {
}
checkResult(patchSetId, "patchset id", changeId);
curr.value = endOfLine;
return new PatchSet.Id(changeId, patchSetId);
return PatchSet.id(changeId, patchSetId);
}
private static Integer parseParentNumber(byte[] note, MutableInteger curr, Change.Id changeId)