Search in sources :

Example 41 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class ResetOperationTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    testRepository = new TestRepository(gitDir);
    repository = testRepository.getRepository();
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) Before(org.junit.Before)

Example 42 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class RewordCommitsOperationTest 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");
    commit = testRepository.addAndCommit(project.getProject(), file, "a commit");
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) File(java.io.File) Before(org.junit.Before)

Example 43 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class TagOperationTest method setUp.

@Before
public void setUp() throws Exception {
    workdir = testUtils.createTempDir("Repository1");
    repository1 = new TestRepository(new File(workdir, Constants.DOT_GIT));
    project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
    testUtils.addFileToProject(project, "folder1/file1.txt", "Hello world");
    repository1.connect(project);
    repository1.trackAllFiles(project);
    repository1.commit("Initial commit");
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) File(java.io.File) Before(org.junit.Before)

Example 44 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class GitFlowRepositoryTest method testFindHeadFailOnEmptyRepository.

@Test(expected = WrongGitFlowStateException.class)
public void testFindHeadFailOnEmptyRepository() throws Exception {
    File workdir3 = testUtils.createTempDir("Repository3");
    TestRepository repository3 = new TestRepository(new File(workdir3, DOT_GIT));
    GitFlowRepository gfRepo = new GitFlowRepository(repository3.getRepository());
    gfRepo.findHead();
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) File(java.io.File) Test(org.junit.Test)

Example 45 with TestRepository

use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.

the class AbstractDualRepositoryTestCase method beforeTestCase.

@Override
@Before
public void beforeTestCase() throws Exception {
    workdir = testUtils.createTempDir("Repository1");
    workdir2 = testUtils.createTempDir("Repository2");
    repository1 = new TestRepository(new File(workdir, DOT_GIT));
    initialCommit = repository1.createInitialCommit("setUp");
    Repository repository = repository1.getRepository();
    new InitOperation(repository).execute(null);
    // now we create a project in repo1
    IProject project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
    testUtils.addFileToProject(project, "folder1/file1.txt", "Hello world");
    repository1.connect(project);
    repository1.trackAllFiles(project);
    repository1.commit("Initial commit");
    // let's get rid of the project
    project.delete(false, false, null);
    // let's clone repository1 to repository2
    URIish uri = repository1.getUri();
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2, R_HEADS + MY_MASTER, DEFAULT_REMOTE_NAME, 0);
    clop.run(null);
    Repository repo2 = Activator.getDefault().getRepositoryCache().lookupRepository(new File(workdir2, DOT_GIT));
    repository2 = new TestRepository(repo2);
}
Also used : URIish(org.eclipse.jgit.transport.URIish) TestRepository(org.eclipse.egit.core.test.TestRepository) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) TestRepository(org.eclipse.egit.core.test.TestRepository) Repository(org.eclipse.jgit.lib.Repository) File(java.io.File) IProject(org.eclipse.core.resources.IProject) CloneOperation(org.eclipse.egit.core.op.CloneOperation) Before(org.junit.Before)

Aggregations

TestRepository (org.eclipse.egit.core.test.TestRepository)45 Before (org.junit.Before)36 File (java.io.File)28 IFile (org.eclipse.core.resources.IFile)15 Git (org.eclipse.jgit.api.Git)6 TestProject (org.eclipse.egit.core.test.TestProject)5 Repository (org.eclipse.jgit.lib.Repository)5 Test (org.junit.Test)5 IProject (org.eclipse.core.resources.IProject)4 CloneOperation (org.eclipse.egit.core.op.CloneOperation)3 URIish (org.eclipse.jgit.transport.URIish)3 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)2 RefUpdate (org.eclipse.jgit.lib.RefUpdate)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 IFolder (org.eclipse.core.resources.IFolder)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1