mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
hg: test fixed - perform copy command using CopyFilesOrDirectoriesHandler instead if VirtualFile copy
* when Copy Dir action from project view or sm similar performed -> CopyFilesOrDirectoriesHandler called, so use the same in test cases; * CopyFilesOrDirectoriesHandler produces one directoryCreated event and one per file fileCopied event (for each directory child), while VF copy produces one fileCopied event for entire dir; GitOrigin-RevId: beb2ba132e58254708aef6d020652bbfea80dc6d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
beb27bf85f
commit
5a51a1b2b5
@@ -12,11 +12,17 @@
|
||||
// limitations under the License.
|
||||
package org.zmlx.hg4idea.test;
|
||||
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.vcs.VcsTestUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.refactoring.copy.CopyFilesOrDirectoriesHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class HgCopyTest extends HgSingleUserTest {
|
||||
|
||||
@@ -59,8 +65,15 @@ public class HgCopyTest extends HgSingleUserTest {
|
||||
VirtualFile parent = createDirInCommand(myWorkingCopyDir, "com");
|
||||
createFileInCommand(parent, "a.txt", "new file content");
|
||||
runHgOnProjectRepo("commit", "-m", "added file");
|
||||
copyFileInCommand(parent, "org");
|
||||
copyDir(parent, "org");
|
||||
verify(runHgOnProjectRepo("status"), HgTestOutputParser.added("org", "a.txt"));
|
||||
}
|
||||
|
||||
|
||||
private void copyDir(@NotNull VirtualFile vDir, @NotNull String newName) throws IOException {
|
||||
WriteCommandAction.writeCommandAction(myProject).run(() -> {
|
||||
PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(vDir);
|
||||
CopyFilesOrDirectoriesHandler.copyToDirectory(psiDirectory, newName, psiDirectory.getParentDirectory());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user