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