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