public ChangeRange revert(ChangeRange reverse) throws IOException {
    final Ref<Long> first = new Ref<>();
    final Ref<Long> last = new Ref<>();
    LocalHistoryFacade.Listener l = new LocalHistoryFacade.Listener() {
      @Override
      public void changeAdded(Change c) {
        if (first.isNull()) first.set(c.getId());
        last.set(c.getId());
      }
    };
    myVcs.addListener(l, null);
    try {
      LOG.debug("Reverting: " + myFromChangeId + " -> " + myToChangeId);
      myVcs.accept(new UndoChangeRevertingVisitor(myGateway, myToChangeId, myFromChangeId));
    }
    catch (UndoChangeRevertingVisitor.RuntimeIOException e) {
      throw (IOException)e.getCause();
    }
    finally {
      myVcs.removeListener(l);
    }

    if (reverse != null) {
      if (first.isNull()) first.set(reverse.myFromChangeId);
      if (last.isNull()) last.set(reverse.myToChangeId);
    }
    return new ChangeRange(myGateway, myVcs, first.get(), last.get());
  }
public ChangeRange revert(ChangeRange reverse)