Search in sources :

Example 6 with TestRepository

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

the class RemoveFromIndexOperationTest method shouldRemoveFromIndexOnInitialCommit.

@Test
public void shouldRemoveFromIndexOnInitialCommit() throws Exception {
    testRepo.dispose();
    FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY);
    testRepo = new TestRepository(gitDir);
    testRepo.connect(project.getProject());
    IFile file = testUtils.addFileToProject(project.getProject(), "file.txt", "content");
    new AddToIndexOperation(asList(file)).execute(null);
    assertTrue(testRepo.inIndex(file.getLocation().toString()));
    new RemoveFromIndexOperation(Arrays.asList(file.getLocation())).execute(null);
    assertFalse(testRepo.inIndex(file.getLocation().toString()));
    assertTrue(file.getLocation().toFile().exists());
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) IFile(org.eclipse.core.resources.IFile) RemoveFromIndexOperation(org.eclipse.egit.core.op.RemoveFromIndexOperation) AddToIndexOperation(org.eclipse.egit.core.op.AddToIndexOperation) Test(org.junit.Test)

Example 7 with TestRepository

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

the class SquashCommitsOperationTest 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-1");
    commit1 = testRepository.addAndCommit(project.getProject(), file, "commit 1");
    testRepository.appendFileContent(file, "file-2");
    commit2 = testRepository.addAndCommit(project.getProject(), file, "commit 2");
    testRepository.appendFileContent(file, "file-3");
    commit3 = testRepository.addAndCommit(project.getProject(), file, "commit 3");
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) File(java.io.File) Before(org.junit.Before)

Example 8 with TestRepository

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

the class StashCreateOperationTest 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);
    repository = testRepository.getRepository();
    testRepository.connect(project.getProject());
    testRepository.commit("initial commit");
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) File(java.io.File) IFile(org.eclipse.core.resources.IFile) Before(org.junit.Before)

Example 9 with TestRepository

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

the class TrackUntrackOperationTest method setUp.

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

Example 10 with TestRepository

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

the class RebaseInteractivePlanTest 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());
    plan = RebaseInteractivePlan.getPlan(testRepository.getRepository());
    toDoElements = new ArrayList<PlanElement>();
    moveHelper = new RebaseInteractivePlan.MoveHelper(toDoElements, plan);
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) RebaseInteractivePlan(org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan) MoveHelper(org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.MoveHelper) File(java.io.File) PlanElement(org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement) 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