use of org.eclipse.egit.core.op.EditCommitOperation in project egit by eclipse.
the class EditCommitOperationTest method edit.
@Test
public void edit() throws Exception {
EditCommitOperation op = new EditCommitOperation(testRepository.getRepository(), firstCommit);
op.execute(new NullProgressMonitor());
assertEquals(RepositoryState.REBASING_INTERACTIVE, testRepository.getRepository().getRepositoryState());
List<RebaseTodoLine> todos = testRepository.getRepository().readRebaseTodo(GIT_REBASE_TODO, false);
assertEquals(1, todos.size());
assertEquals(RebaseTodoLine.Action.PICK, todos.get(0).getAction());
assertTrue(secondCommit.getId().startsWith(todos.get(0).getCommit()));
ObjectId headId = testRepository.getRepository().resolve(Constants.HEAD);
assertEquals(firstCommit.getId(), headId);
}
use of org.eclipse.egit.core.op.EditCommitOperation in project egit by eclipse.
the class EditHandler method editCommit.
/**
* @param commit
* @param repo
* @param shell
* @return true, if edit was started, false if user aborted
*/
public static boolean editCommit(RevCommit commit, Repository repo, Shell shell) {
try {
if (!UIRepositoryUtils.handleUncommittedFiles(repo, shell))
return false;
} catch (GitAPIException e) {
Activator.logError(e.getMessage(), e);
return false;
}
final EditCommitOperation op = new EditCommitOperation(repo, commit);
JobUtil.scheduleUserWorkspaceJob(op, MessageFormat.format(UIText.EditHandler_JobName, commit.name()), JobFamilies.EDIT);
return true;
}
Aggregations