use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class ConnectProviderOperationTest method testNewUnsharedFile.
@Test
public void testNewUnsharedFile() throws CoreException, Exception {
project.createSourceFolder();
IFile fileA = project.getProject().getFolder("src").getFile("A.java");
String srcA = "class A {\n" + "}\n";
fileA.create(new ByteArrayInputStream(srcA.getBytes("UTF-8")), false, null);
TestRepository thisGit = new TestRepository(gitDir);
File committable = new File(fileA.getLocationURI());
thisGit.addAndCommit(project.project, committable, "testNewUnsharedFile\n\nJunit tests\n");
assertNull(RepositoryProvider.getProvider(project.getProject()));
ConnectProviderOperation operation = new ConnectProviderOperation(project.getProject(), gitDir);
operation.execute(null);
assertNotNull(RepositoryProvider.getProvider(project.getProject()));
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class CreatePatchOperationTest method testComputeWorkspacePathRepoAboveProject.
@Test
public void testComputeWorkspacePathRepoAboveProject() throws Exception {
testRepository.disconnect(project.getProject());
// new setup
project = new TestProject(true, "repo/bundles/Project-1", true, null);
File repo = new File(project.getProject().getLocationURI().getPath()).getParentFile().getParentFile();
gitDir = new File(repo, Constants.DOT_GIT);
testRepository = new TestRepository(gitDir);
testRepository.connect(project.getProject());
IPath oldPath = CreatePatchOperation.computeWorkspacePath(new Path("bundles/Project-1/test-file"), project.getProject());
IPath newPath = CreatePatchOperation.computeWorkspacePath(new Path("bundles/Project-1/test-file"), project.getProject());
assertPatch("test-file", oldPath.toString());
assertPatch("test-file", newPath.toString());
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class CreatePatchOperationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
testRepository = new TestRepository(gitDir);
testRepository.connect(project.getProject());
file = testRepository.createFile(project.getProject(), "test-file");
commit = testRepository.addAndCommit(project.getProject(), file, "new file");
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class EditCommitOperationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
testRepository = new TestRepository(gitDir);
testRepository.connect(project.getProject());
testRepository.createInitialCommit("initial");
File file = testRepository.createFile(project.getProject(), "file");
firstCommit = testRepository.addAndCommit(project.getProject(), file, "a commit");
testRepository.appendFileContent(file, "some text");
secondCommit = testRepository.addAndCommit(project.getProject(), file, "second commit");
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class MergeOperationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
testRepository = new TestRepository(gitDir);
testRepository.connect(project.getProject());
File file1 = testRepository.createFile(project.getProject(), "file1-1");
testRepository.addAndCommit(project.getProject(), file1, "master commit 1");
testRepository.createBranch(MASTER, SIDE);
testRepository.appendFileContent(file1, "file1-2");
secondCommit = testRepository.addAndCommit(project.getProject(), file1, "master commit 2");
testRepository.checkoutBranch(SIDE);
}
Aggregations