Search in sources :

Example 66 with VirtualFile

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

the class HgMergeProviderTest method testMergeWithCommittedLocalChange.

public void testMergeWithCommittedLocalChange() 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, commit the change.
    cd(myChildRepo);
    HgTestUtil.printToFile(childFile, "local");
    hg("commit -m " + COMMIT_MESSAGE);
    updateProject();
    //committing conflicting change
    verifyMergeData(childFile, "basic", "local", "server");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile)

Example 67 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 68 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 69 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 70 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)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)5465 File (java.io.File)762 Project (com.intellij.openapi.project.Project)720 Nullable (org.jetbrains.annotations.Nullable)720 NotNull (org.jetbrains.annotations.NotNull)703 PsiFile (com.intellij.psi.PsiFile)571 Module (com.intellij.openapi.module.Module)501 IOException (java.io.IOException)327 ArrayList (java.util.ArrayList)260 Document (com.intellij.openapi.editor.Document)244 PsiElement (com.intellij.psi.PsiElement)209 Test (org.junit.Test)196 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)115 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)101 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)91 List (java.util.List)90