Inline Patch.Key#getParentKey

This refactoring step was missed in I9087151a.

Change-Id: Idb00e5917cde398c02295dd892182a165f41bb38
This commit is contained in:
Dave Borowitz
2019-04-23 10:41:49 -07:00
parent ad17233547
commit e9f1a4d62a
5 changed files with 10 additions and 14 deletions

View File

@@ -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<ChangeEdit> 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;

View File

@@ -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. */

View File

@@ -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,

View File

@@ -140,7 +140,7 @@ public class GetDiff implements RestReadView<FileResource> {
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<FileResource> {
List<DiffWebLinkInfo> 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;

View File

@@ -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();