Source:
public VoidResult call() throws EmailException, InvalidChangeOperationException, NoSuchChangeException, OrmException { final String ref = (branch.startsWith(Constants.R_REFS) ? "" : Constants.R_HEADS) + branch; final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl control = changeControlFactory.validateFor(changeId); if (!control.canMoveTo(ref)) { throw new InvalidChangeOperationException("Permission denied moving change " + changeId + " destination to " + branch + " branch"); } final PatchSet patch = db.patchSets().get(patchSetId); if (patch == null) { throw new NoSuchChangeException(changeId); } final ChangeMessage cmsg = new ChangeMessage(new ChangeMessage.Key(changeId, ChangeUtil .messageUUID(db)), currentUser.getAccountId(), patchSetId); final StringBuilder msgBuf = new StringBuilder("Patch set " + patchSetId.get() + ": Change destination moved to " + branch + " branch"); if (changeComment != null && changeComment.length() > 0) { msgBuf.append("\n\n"); msgBuf.append(changeComment); } cmsg.setMessage(msgBuf.toString()); final Change updatedChange = db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.NEW && change.currentPatchSetId().equals(patchSetId)) { change.setDest(new Branch.NameKey(change.getProject(), ref)); ChangeUtil.updated(change); return change; } else { return null; } } }); if (updatedChange == null) { String err = "Change is closed or patchset is not latest"; throw new InvalidChangeOperationException(err); } db.changeMessages().insert(Collections.singleton(cmsg)); ApprovalsUtil.clearCurrentPatchSetApprovals(db, updatedChange); return VoidResult.INSTANCE; }

Target:
public VoidResult call() throws EmailException, InvalidChangeOperationException, NoSuchChangeException, OrmException { final String ref = (branch.startsWith(Constants.R_REFS) ? "" : Constants.R_HEADS) + branch; final Change.Id changeId = patchSetId.getParentKey(); final ChangeControl control = changeControlFactory.validateFor(changeId); if (!control.canMoveTo(ref)) { throw new InvalidChangeOperationException("Permission denied moving" + " destination branch to " + branch + " for change " + changeId); } final PatchSet patch = db.patchSets().get(patchSetId); if (patch == null) { throw new NoSuchChangeException(changeId); } final ChangeMessage cmsg = new ChangeMessage(new ChangeMessage.Key(changeId, ChangeUtil .messageUUID(db)), currentUser.getAccountId(), patchSetId); final StringBuilder msgBuf = new StringBuilder("Patch set " + patchSetId.get() + ": Change destination moved to " + branch + " branch"); if (changeComment != null && changeComment.length() > 0) { msgBuf.append("\n\n"); msgBuf.append(changeComment); } cmsg.setMessage(msgBuf.toString()); final Change updatedChange = db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.NEW && change.currentPatchSetId().equals(patchSetId)) { change.setDest(new Branch.NameKey(change.getProject(), ref)); ChangeUtil.updated(change); return change; } else { return null; } } }); if (updatedChange == null) { String err = "Change is closed or patchset is not latest"; throw new InvalidChangeOperationException(err); } db.changeMessages().insert(Collections.singleton(cmsg)); ApprovalsUtil.clearCurrentPatchSetApprovals(db, updatedChange); return VoidResult.INSTANCE; }