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);
}
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");
}
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);
}
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);
}
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"));
}
Aggregations