diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Revert.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Revert.java index 16d80a52f4..1ccac95bd8 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Revert.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Revert.java @@ -125,7 +125,6 @@ public class Revert implements RestModifyView, Change.Id revertedChangeId; try { revertedChangeId = revert(req.getControl(), - change.currentPatchSetId(), Strings.emptyToNull(input.message)); } catch (NoSuchChangeException e) { throw new ResourceNotFoundException(e.getMessage()); @@ -134,11 +133,12 @@ public class Revert implements RestModifyView, revertedChangeId); } - private Change.Id revert(ChangeControl ctl, PatchSet.Id patchSetId, - String message) throws NoSuchChangeException, OrmException, - MissingObjectException, IncorrectObjectTypeException, IOException, - RestApiException, UpdateException { - Change.Id changeIdToRevert = patchSetId.getParentKey(); + private Change.Id revert(ChangeControl ctl, String message) + throws NoSuchChangeException, OrmException, MissingObjectException, + IncorrectObjectTypeException, IOException, RestApiException, + UpdateException { + Change.Id changeIdToRevert = ctl.getChange().getId(); + PatchSet.Id patchSetId = ctl.getChange().currentPatchSetId(); PatchSet patch = psUtil.get(db.get(), ctl.getNotes(), patchSetId); if (patch == null) { throw new NoSuchChangeException(changeIdToRevert);