Example usage for org.eclipse.jgit.lib Repository writeRebaseTodoFile

List of usage examples for org.eclipse.jgit.lib Repository writeRebaseTodoFile

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Repository writeRebaseTodoFile.

Prototype

public void writeRebaseTodoFile(String path, List<RebaseTodoLine> steps, boolean append) throws IOException 

Source Link

Document

Write a file formatted like a git-rebase-todo file.

Usage

From source file:org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.java

License:Open Source License

/**
 * Writes the plan to the FS./*from w w w. j  a v a  2  s .co  m*/
 * <p>
 * Only {@link PlanElement Elements} of {@link ElementType#TODO} are
 * persisted.
 *
 * @param repository
 *            the plan belongs to
 *
 * @return true if the todo file has been written successfully, otherwise
 *         false
 */
private boolean persist(Repository repository) {
    if (repository == null || repository.getRepositoryState() != RepositoryState.REBASING_INTERACTIVE) {
        return false;
    }
    List<RebaseTodoLine> todoLines = new LinkedList<RebaseTodoLine>();
    for (PlanElement element : planList.getSecondList())
        todoLines.add(element.getRebaseTodoLine());
    try {
        repository.writeRebaseTodoFile(REBASE_TODO, todoLines, false);
    } catch (IOException e) {
        Activator.logError(CoreText.RebaseInteractivePlan_WriteRebaseTodoFailed, e);
        throw new RuntimeException(e);
    }
    return true;
}