String (final @NotNull RootEntry root, @NotNull String path, final ChangeSet targetChangeSet, final Change targetChange, final boolean revertTargetChange, final boolean warnOnFileNotFound) { final String[] result = {path}; myChangeList.accept(new ChangeVisitor() { @Override public void begin(ChangeSet c) throws StopVisitingException { if (!revertTargetChange && c.equals(targetChangeSet)) stop(); } @Override public void end(ChangeSet c) throws StopVisitingException { if (c.equals(targetChangeSet)) stop(); } @Override public void visit(PutLabelChange c) throws StopVisitingException { if (c.equals(targetChange)) stop(); } @Override public void visit(StructuralChange c) throws StopVisitingException { if (!revertTargetChange && c.equals(targetChange)) stop(); if (c.affectsPath(result[0])) { c.revertOn(root, warnOnFileNotFound); result[0] = c.revertPath(result[0]); } if (c.equals(targetChange)) stop(); } }); return result[0]; }