diff --git a/java/com/google/gerrit/httpd/raw/CatServlet.java b/java/com/google/gerrit/httpd/raw/CatServlet.java index 79f3d8bf24..5a3c6ce3c6 100644 --- a/java/com/google/gerrit/httpd/raw/CatServlet.java +++ b/java/com/google/gerrit/httpd/raw/CatServlet.java @@ -118,13 +118,13 @@ public class CatServlet extends HttpServlet { } } - final Change.Id changeId = patchKey.getParentKey().changeId(); + final Change.Id changeId = patchKey.patchSetId().changeId(); String revision; try { ChangeNotes notes = changeNotesFactory.createChecked(changeId); permissionBackend.currentUser().change(notes).check(ChangePermission.READ); projectCache.checkedGet(notes.getProjectName()).checkStatePermitsRead(); - if (patchKey.getParentKey().get() == 0) { + if (patchKey.patchSetId().get() == 0) { // change edit Optional edit = changeEditUtil.byChange(notes); if (edit.isPresent()) { @@ -134,7 +134,7 @@ public class CatServlet extends HttpServlet { return; } } else { - PatchSet patchSet = psUtil.get(notes, patchKey.getParentKey()); + PatchSet patchSet = psUtil.get(notes, patchKey.patchSetId()); if (patchSet == null) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; diff --git a/java/com/google/gerrit/reviewdb/client/Patch.java b/java/com/google/gerrit/reviewdb/client/Patch.java index 89f30576e1..0f7e4cf8d7 100644 --- a/java/com/google/gerrit/reviewdb/client/Patch.java +++ b/java/com/google/gerrit/reviewdb/client/Patch.java @@ -64,10 +64,6 @@ public final class Patch { public abstract PatchSet.Id patchSetId(); public abstract String fileName(); - - public PatchSet.Id getParentKey() { - return patchSetId(); - } } /** Type of modification made to the file path. */ diff --git a/java/com/google/gerrit/reviewdb/client/PatchLineComment.java b/java/com/google/gerrit/reviewdb/client/PatchLineComment.java index 6271d19bd4..03359ba155 100644 --- a/java/com/google/gerrit/reviewdb/client/PatchLineComment.java +++ b/java/com/google/gerrit/reviewdb/client/PatchLineComment.java @@ -149,7 +149,7 @@ public final class PatchLineComment { } public PatchSet.Id getPatchSetId() { - return patchKey.getParentKey(); + return patchKey.patchSetId(); } public int getLine() { @@ -259,7 +259,7 @@ public final class PatchLineComment { public Comment asComment(String serverId) { Comment c = new Comment( - new Comment.Key(uuid, patchKey.fileName(), patchKey.getParentKey().get()), + new Comment.Key(uuid, patchKey.fileName(), patchKey.patchSetId().get()), author, writtenOn, side, diff --git a/java/com/google/gerrit/server/restapi/change/GetDiff.java b/java/com/google/gerrit/server/restapi/change/GetDiff.java index d832598c12..8b5cdaf757 100644 --- a/java/com/google/gerrit/server/restapi/change/GetDiff.java +++ b/java/com/google/gerrit/server/restapi/change/GetDiff.java @@ -140,7 +140,7 @@ public class GetDiff implements RestReadView { PatchScriptFactory psf; PatchSet basePatchSet = null; - PatchSet.Id pId = resource.getPatchKey().getParentKey(); + PatchSet.Id pId = resource.getPatchKey().patchSetId(); String fileName = resource.getPatchKey().fileName(); ChangeNotes notes = resource.getRevision().getNotes(); if (base != null) { @@ -204,11 +204,11 @@ public class GetDiff implements RestReadView { List links = webLinks.getDiffLinks( state.getName(), - resource.getPatchKey().getParentKey().changeId().get(), + resource.getPatchKey().patchSetId().changeId().get(), basePatchSet != null ? basePatchSet.getId().get() : null, revA, MoreObjects.firstNonNull(ps.getOldName(), ps.getNewName()), - resource.getPatchKey().getParentKey().get(), + resource.getPatchKey().patchSetId().get(), revB, ps.getNewName()); result.webLinks = links.isEmpty() ? null : links; diff --git a/java/com/google/gerrit/server/restapi/change/Reviewed.java b/java/com/google/gerrit/server/restapi/change/Reviewed.java index 32dcf27483..7152799f61 100644 --- a/java/com/google/gerrit/server/restapi/change/Reviewed.java +++ b/java/com/google/gerrit/server/restapi/change/Reviewed.java @@ -40,7 +40,7 @@ public class Reviewed { accountPatchReviewStore.call( s -> s.markReviewed( - resource.getPatchKey().getParentKey(), + resource.getPatchKey().patchSetId(), resource.getAccountId(), resource.getPatchKey().fileName())); return reviewFlagUpdated ? Response.created("") : Response.ok(""); @@ -61,7 +61,7 @@ public class Reviewed { accountPatchReviewStore.run( s -> s.clearReviewed( - resource.getPatchKey().getParentKey(), + resource.getPatchKey().patchSetId(), resource.getAccountId(), resource.getPatchKey().fileName())); return Response.none();