in src/org/jetbrains/tfsIntegration/core/tfs/operations/ApplyGetOperations.java [378:435]
private void processFolderChange(final GetOperation operation) throws TfsException {
File source = VersionControlPath.getFile(operation.getSlocal());
File target = VersionControlPath.getFile(operation.getTlocal());
final ChangeTypeMask change = new ChangeTypeMask(operation.getChg());
if (source.equals(target) &&
operation.getLver() == operation.getSver() &&
(change.containsOnly(ChangeType_type0.Rename) || (myDownloadMode != DownloadMode.FORCE && myDownloadMode != DownloadMode.MERGE))) {
// rename + source=target means rename of parent folder
// not an explicit change, nothing to do
updateLocalVersion(operation);
return;
}
// redundand check source.equals(target) for consistency with processFileChange()
if (!source.equals(target) && source.isFile() && !source.canWrite() && !deleteFile(source)) {
return;
}
if (target.isFile() && !target.canWrite() && !deleteFile(target)) {
return;
}
if (target.isFile() && target.canWrite() && (!canOverrideLocalConflictingItem(operation, false) || !deleteFile(target))) {
return;
}
if (!createFolder(target.getParentFile())) {
return;
}
if (!target.exists()) {
if (source.isDirectory()) {
// source exists, target is not
if (rename(source, target)) {
addToGroup(FileGroup.UPDATED_ID, target, operation);
updateLocalVersion(operation);
}
}
else {
// source & target not exist
// don't create folder if undoing locally missing scheduled for addition folder
if (!change.contains(ChangeType_type0.Add) || !source.equals(target) || operation.getLver() != operation.getSver()) {
if (createFolder(target)) {
addToGroup(FileGroup.CREATED_ID, target, operation);
updateLocalVersion(operation);
}
}
}
}
else {
// target exists
if (!source.equals(target)) {
deleteFile(source);
}
updateLocalVersion(operation);
}
}