in src/net/sourceforge/transparent/Checkin/CCaseRollbackEnvironment.java [167:225]
private void rollbackChanged( List<Change> changes, HashSet<FilePath> processedFiles, List<VcsException> errors,
@NotNull final RollbackProgressListener listener)
{
for( Change change : changes )
{
if( !VcsUtil.isChangeForNew( change ) &&
!VcsUtil.isChangeForDeleted(change))
{
final boolean isRenameChange = VcsUtil.isRenameChange(change);
if (VcsUtil.isChangeForFolder(change) && isRenameChange) {
final File wasFile = change.getBeforeRevision().getFile().getIOFile();
final Status status = host.getStatus(wasFile);
if (! (Status.CHECKED_OUT.equals(status) || Status.HIJACKED.equals(status))) {
continue;
}
}
FilePath filePath = change.getAfterRevision().getFile();
String path = filePath.getPath();
listener.accept(change);
if(isRenameChange)
{
// Track two different cases:
// - we delete the file which is already in the repository.
// Here we need to "Get" the latest version of the original
// file from the repository and delete the new file.
// - we delete the renamed file which is new and does not exist
// in the repository. We need to ignore the error message from
// the SourceSafe ("file not existing") and just delete the
// new file.
List<VcsException> localErrors = new ArrayList<>();
FilePath oldFile = change.getBeforeRevision().getFile();
host.undoCheckoutFile( oldFile.getIOFile(), localErrors );
if( localErrors.size() > 0 && !isUnknownFileError( localErrors ) ) {
errors.addAll( localErrors );
}
host.renamedFiles.remove( filePath.getPath() );
FileUtil.delete( new File( path ) );
}
else
{
final Status fileStatus = host.getStatusSafely(filePath.getIOFile());
if (! Status.HIJACKED.equals(fileStatus)) {
if (filePath.getVirtualFile() == null) {
host.undoCheckoutFile( filePath.getIOFile(), errors );
} else {
host.undoCheckoutFile( filePath.getVirtualFile(), errors );
}
} else {
updateFile( path, errors );
}
}
processedFiles.add( filePath );
}
}
}