Source:
public Output apply(RevisionResource revision, ReviewInput input) throws AuthException, BadRequestException, UnprocessableEntityException, OrmException, IOException { if (input.onBehalfOf != null) { revision = onBehalfOf(revision, input); } if (input.labels != null) { checkLabels(revision, input.strictLabels, input.labels); } if (input.comments != null) { checkComments(input.comments); } if (input.notify == null) { log.warn("notify = null; assuming notify = NONE"); input.notify = NotifyHandling.NONE; } ChangeUpdate update = null; db.get().changes().beginTransaction(revision.getChange().getId()); boolean dirty = false; try { change = db.get().changes().get(revision.getChange().getId()); ChangeUtil.updated(change); timestamp = change.getLastUpdatedOn(); update = updateFactory.create(change, timestamp); dirty |= insertComments(revision, input.comments, input.drafts); dirty |= updateLabels(revision, update, input.labels); dirty |= insertMessage(revision, input.message); if (dirty) { db.get().changes().update(Collections.singleton(change)); db.get().commit(); } } finally { db.get().rollback(); } if (update != null) { update.commit(); } CheckedFuture<?, IOException> indexWrite; if (dirty) { indexWrite = indexer.indexAsync(change.getId()); } else { indexWrite = Futures.<Void, IOException> immediateCheckedFuture(null); } if (input.notify.compareTo(NotifyHandling.NONE) > 0 && message != null) { email.create( input.notify, change, revision.getPatchSet(), revision.getAccountId(), message, comments).sendAsync(); fireCommentAddedHook(revision); } Output output = new Output(); output.labels = input.labels; indexWrite.checkedGet(); return output; }

Target:
public Output apply(RevisionResource revision, ReviewInput input) throws AuthException, BadRequestException, UnprocessableEntityException, OrmException, IOException { if (input.onBehalfOf != null) { revision = onBehalfOf(revision, input); } if (input.labels != null) { checkLabels(revision, input.strictLabels, input.labels); } if (input.comments != null) { checkComments(input.comments); } if (input.notify == null) { log.warn("notify = null; assuming notify = NONE"); input.notify = NotifyHandling.NONE; } ChangeUpdate update = null; db.get().changes().beginTransaction(revision.getChange().getId()); boolean dirty = false; try { change = db.get().changes().get(revision.getChange().getId()); ChangeUtil.updated(change); timestamp = change.getLastUpdatedOn(); update = updateFactory.create( change, timestamp, revision.getUser().getAccount()); dirty |= insertComments(revision, input.comments, input.drafts); dirty |= updateLabels(revision, update, input.labels); dirty |= insertMessage(revision, input.message); if (dirty) { db.get().changes().update(Collections.singleton(change)); db.get().commit(); } } finally { db.get().rollback(); } if (update != null) { update.commit(); } CheckedFuture<?, IOException> indexWrite; if (dirty) { indexWrite = indexer.indexAsync(change.getId()); } else { indexWrite = Futures.<Void, IOException> immediateCheckedFuture(null); } if (input.notify.compareTo(NotifyHandling.NONE) > 0 && message != null) { email.create( input.notify, change, revision.getPatchSet(), revision.getAccountId(), message, comments).sendAsync(); fireCommentAddedHook(revision); } Output output = new Output(); output.labels = input.labels; indexWrite.checkedGet(); return output; }