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);
}

0
8 comments
Avatar
Permanently deleted user

Hello Thibaut,

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<VcsException> rollbackChanges(List<Change> changes);


This is the most common case of rollback: rolling back changes to files which
have been checked out.

// is this called to rolback a file deletion ?
List<VcsException> rollbackMissingFileDeletion(List<FilePath>
files);


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.

List<VcsException> rollbackModifiedWithoutCheckout(List<VirtualFile>
files);


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.

void rollbackIfUnchanged(VirtualFile file);


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!"


0
Avatar
Permanently deleted user

thanks for the very detailed explanations, It would be nice to put those descriptions in the javadoc :)

0
Avatar
Permanently deleted user

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 ?

0
Avatar
Permanently deleted user

Hello Thibaut,

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<Change>
changes); will be called, is this right ?


Right.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Avatar
Permanently deleted user

Hello Thibaut,

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<Change>
changes); will be called, is this right ?


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!"


0
Avatar
Permanently deleted user

ok, this is clear, thanks

0
Avatar
Permanently deleted user

Hello Thibaut,

thanks for the very detailed explanations, It would be nice to put
those descriptions in the javadoc :)


Done. :)

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Avatar
Permanently deleted user

pretty sure the next guy looking for those informations will take advantage of them !
Thanks

0

Please sign in to leave a comment.