RollbackEnvironment questions
Hi,
I'm looking at implementing the revert/rollback operations for the mks plugin, but i don't really understand the differences between the different APIs that exist in the RollbackEnvironment interface.
public interface RollbackEnvironment {
String getRollbackOperationName(); // this one I get :)
List rollbackChanges(List changes);
// is this called to rolback a file deletion ?
List rollbackMissingFileDeletion(List files);
List rollbackModifiedWithoutCheckout(List]]> files);
void rollbackIfUnchanged(VirtualFile file);
}
Please sign in to leave a comment.
Hello Thibaut,
This is the most common case of rollback: rolling back changes to files which
have been checked out.
This is called for files reported as "locally deleted": the user has deleted
the file locally but not scheduled it for deletion from VCS. The implementation
of this method should get the current version of the listed files from the
VCS.
You don't need to implement this method if you never report such files to
ChangelistBuilder.
This is called for files reported as "modified without checkout": the user
has made a file writable but did not checkout it from the VCS.
Just as the previous one: You don't need to implement this method if you
never report such files to ChangelistBuilder.
This is called when the user performs an "undo" that returns a file to a
state in which it was checked out or last saved. The implementation of this
method can compare the current state of the file with the base revision and
undo the checkout if the file is identical. Implementing this method is optional.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
thanks for the very detailed explanations, It would be nice to put those descriptions in the javadoc :)
one more question : if a user locally creates a file and schedule for addition to the vcs.
THen , he rolls this back, i understand rollbackChanges(List]]> changes); will be called, is this right ?
Hello Thibaut,
Right.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hello Thibaut,
One more clarification: in this case the checkbox "Delete local copies of
added files" will be shown in the "Rollback changes" dialog, and if the user
checks it, IDEA will delete the corresponding files after calling rollbackChanges().
Thus the RollbackEnvironment implementation should not delete the files in
this case, but rather leave them in unversioned state)
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
ok, this is clear, thanks
Hello Thibaut,
Done. :)
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
pretty sure the next guy looking for those informations will take advantage of them !
Thanks