apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java/ReleaseService/rollbackTo
class ReleaseService:  @Transactional
  public Release rollbackTo(long releaseId, long toReleaseId, String operator) {
    if (releaseId == toReleaseId) {
      throw new BadRequestException("current release equal to target release");
    }

    Release release = findOne(releaseId);
    Release toRelease = findOne(toReleaseId);
    if (release == null || toRelease == null) {
      throw new NotFoundException("release not found");
    }
    if (release.isAbandoned() || toRelease.isAbandoned()) {
      throw new BadRequestException("release is not active");
    }

    String appId = release.getAppId();
    String clusterName = release.getClusterName();
    String namespaceName = release.getNamespaceName();

    List<Release> releases = findActiveReleasesBetween(appId, clusterName, namespaceName,
                                                       toReleaseId, releaseId);

    for (int i = 0; i < releases.size() - 1; i++) {
      releases.get(i).setAbandoned(true);
      releases.get(i).setDataChangeLastModifiedBy(operator);
    }

    releaseRepository.saveAll(releases);

    releaseHistoryService.createReleaseHistory(appId, clusterName,
                                               namespaceName, clusterName, toReleaseId,
                                               release.getId(), ReleaseOperation.ROLLBACK, null, operator);

    //publish child namespace if namespace has child
    rollbackChildNamespace(appId, clusterName, namespaceName, Lists.newArrayList(release, toRelease), operator);

    return release;
  }