Search in sources :

Example 96 with VirtualFile

use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.

the class HgMergeProviderTest method prepareFileInBothRepositories.

/**
   * Creates a file with initial content in the parent repository, pulls & updates it to the child repository.
   *
   * @return References to the files in parent and child repositories respectively.
   */
private Pair<VirtualFile, VirtualFile> prepareFileInBothRepositories() throws IOException {
    cd(myRepository);
    String aFile = "A.txt";
    touch(aFile, "basic");
    hg("add " + aFile);
    hg("commit -m 'create file' ");
    hg("update");
    myRepository.refresh(false, true);
    final VirtualFile parentFile = myRepository.findChild(aFile);
    assertNotNull("Can't find " + aFile + " in parent repo!", parentFile);
    cd(myChildRepo);
    hg("pull");
    hg("update");
    myChildRepo.refresh(false, true);
    final VirtualFile childFile = myChildRepo.findChild(aFile);
    return Pair.create(parentFile, childFile);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile)

Example 97 with VirtualFile

use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.

the class HgMergeProviderTest method testMergeWithUncommittedLocalChange.

public void testMergeWithUncommittedLocalChange() throws Exception {
    prepareSecondRepository();
    final Pair<VirtualFile, VirtualFile> files = prepareFileInBothRepositories();
    final VirtualFile parentFile = files.first;
    final VirtualFile childFile = files.second;
    //Edit the file in parent repository, commit the change.
    cd(myRepository);
    HgTestUtil.printToFile(parentFile, "server");
    hg("commit -m " + COMMIT_MESSAGE);
    // Edit the file in child repository, don't commit the change.
    cd(myChildRepo);
    HgTestUtil.printToFile(childFile, "local");
    updateProject();
    //uncommitted conflicting change
    verifyMergeData(childFile, "basic", "local", "server");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile)

Example 98 with VirtualFile

use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.

the class HgAddTest method filesInDirsAddedViaChangeListShouldBeAddedToHg.

/**
   * 1. Create some files and directories in the file system.
   * 2. Add them to the VCS via the ChangeListManager.
   * 3. Verify that they are added to the VCS.
   */
@Test
public void filesInDirsAddedViaChangeListShouldBeAddedToHg() throws Exception {
    final VirtualFile afile = createFileInCommand(AFILE, INITIAL_FILE_CONTENT);
    final VirtualFile bdir = createDirInCommand(myWorkingCopyDir, BDIR);
    final VirtualFile bfile = createFileInCommand(bdir, BFILE, INITIAL_FILE_CONTENT);
    myChangeListManager.addUnversionedFilesToVcs(afile, bdir, bfile);
    verifyStatus(added(AFILE), added(BFILE_PATH));
    myChangeListManager.checkFilesAreInList(true, afile, bfile);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Test(org.testng.annotations.Test)

Example 99 with VirtualFile

use of com.intellij.openapi.vfs.VirtualFile in project intellij-community by JetBrains.

the class HgAddTest method fileAddedViaChangeListShouldBeAddedToHg.

/**
   * 1. Create a file in the file system.
   * 2. Add the unversioned file to the VCS using the ChangeListManager.
   * 3. Verify that the file was added to the VCS.
   */
@Test
public void fileAddedViaChangeListShouldBeAddedToHg() throws Exception {
    final VirtualFile vf = createFileInCommand(AFILE, INITIAL_FILE_CONTENT);
    myChangeListManager.addUnversionedFilesToVcs(vf);
    verifyStatus(added(AFILE));
    myChangeListManager.checkFilesAreInList(true, vf);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Test(org.testng.annotations.Test)

Example 100 with VirtualFile

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"));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Test(org.testng.annotations.Test)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)5443 File (java.io.File)757 Nullable (org.jetbrains.annotations.Nullable)719 Project (com.intellij.openapi.project.Project)718 NotNull (org.jetbrains.annotations.NotNull)703 PsiFile (com.intellij.psi.PsiFile)564 Module (com.intellij.openapi.module.Module)495 IOException (java.io.IOException)327 ArrayList (java.util.ArrayList)258 Document (com.intellij.openapi.editor.Document)241 PsiElement (com.intellij.psi.PsiElement)205 Test (org.junit.Test)193 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)124 PsiDirectory (com.intellij.psi.PsiDirectory)124 XmlFile (com.intellij.psi.xml.XmlFile)124 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)116 Editor (com.intellij.openapi.editor.Editor)114 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)100 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)91 List (java.util.List)90