use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgCopyTest method testCopyModifiedFile.
@Test
public void testCopyModifiedFile() throws Exception {
VirtualFile file = createFileInCommand("a.txt", "new file content");
runHgOnProjectRepo("commit", "-m", "added file");
VcsTestUtil.editFileInCommand(myProject, file, "newer content");
verify(runHgOnProjectRepo("status"), HgTestOutputParser.modified("a.txt"));
copyFileInCommand(file, "b.txt");
verify(runHgOnProjectRepo("status"), HgTestOutputParser.modified("a.txt"), HgTestOutputParser.added("b.txt"));
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgCopyTest method testCopyCopiedFile.
@Test
public void testCopyCopiedFile() throws Exception {
VirtualFile file = createFileInCommand("a.txt", "new file content");
runHgOnProjectRepo("commit", "-m", "added file");
copyFileInCommand(file, "b.txt");
copyFileInCommand(file, "c.txt");
verify(runHgOnProjectRepo("status"), HgTestOutputParser.added("b.txt"), HgTestOutputParser.added("c.txt"));
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgDeleteTest method testJustDeletedAndThenAddedFileShouldNotBePromptedForRemoval.
/**
* A file is also considered to be newly added, if it has a history, but the last action was removal of that file.
* 1. Create a file, add it to the repository and commit.
* 2. Delete the file and commit it.
* 3. Create the file again and add it to the repository.
* 4. Delete the file.
* 5. File shouldn't be prompted for removal from repository.
*/
@Test
public void testJustDeletedAndThenAddedFileShouldNotBePromptedForRemoval() throws Exception {
VirtualFile vf = createFileInCommand("a.txt", null);
myChangeListManager.commitFiles(vf);
deleteFileInCommand(vf);
myChangeListManager.commitFiles(vf);
showConfirmation(VcsConfiguration.StandardConfirmation.REMOVE);
vf = createFileInCommand("a.txt", null);
final HgMockVcsHelper helper = registerMockVcsHelper();
helper.addListener(new VcsHelperListener() {
@Override
public void dialogInvoked() {
fail("No dialog should be invoked, because newly added file should be silently removed from the repository");
}
});
VcsTestUtil.deleteFileInCommand(myProject, vf);
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgDeleteTest method testDeleteModifiedFile.
@Test
public void testDeleteModifiedFile() throws Exception {
VirtualFile file = createFileInCommand("a.txt", "new file content");
runHgOnProjectRepo("commit", "-m", "added file");
VcsTestUtil.editFileInCommand(myProject, file, "even newer content");
verify(runHgOnProjectRepo("status"), HgTestOutputParser.modified("a.txt"));
deleteFileInCommand(file);
verify(runHgOnProjectRepo("status"), HgTestOutputParser.removed("a.txt"));
}
use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.
the class HgDeleteTest method testNewlyAddedFileShouldNotBePromptedForRemoval.
/**
* When deleting a file which was newly added to repository, this file shouldn't be prompted for removal from the repository.
* 1. Create a file and add it to the repository.
* 2. Remove the file from disk.
* 3. File shouldn't be prompted for removal from repository.
*/
@Test
public void testNewlyAddedFileShouldNotBePromptedForRemoval() throws Exception {
showConfirmation(VcsConfiguration.StandardConfirmation.REMOVE);
final VirtualFile vf = createFileInCommand("a.txt", null);
final HgMockVcsHelper helper = registerMockVcsHelper();
helper.addListener(new VcsHelperListener() {
@Override
public void dialogInvoked() {
fail("No dialog should be invoked, because newly added file should be silently removed from the repository");
}
});
deleteFileInCommand(vf);
}
Aggregations