|
|
@ -43,17 +43,17 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.eclipse.jgit.lib; |
|
|
|
package org.eclipse.jgit.lib; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedWriter; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.OutputStreamWriter; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.util.LinkedList; |
|
|
|
import java.util.LinkedList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.lib.RebaseTodoLine.Action; |
|
|
|
import org.eclipse.jgit.lib.RebaseTodoLine.Action; |
|
|
|
import org.eclipse.jgit.util.IO; |
|
|
|
import org.eclipse.jgit.util.IO; |
|
|
|
import org.eclipse.jgit.util.RawParseUtils; |
|
|
|
import org.eclipse.jgit.util.RawParseUtils; |
|
|
|
|
|
|
|
import org.eclipse.jgit.util.io.SafeBufferedOutputStream; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Offers methods to read and write files formatted like the git-rebase-todo |
|
|
|
* Offers methods to read and write files formatted like the git-rebase-todo |
|
|
@ -216,9 +216,8 @@ public class RebaseTodoFile { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void writeRebaseTodoFile(String path, List<RebaseTodoLine> steps, |
|
|
|
public void writeRebaseTodoFile(String path, List<RebaseTodoLine> steps, |
|
|
|
boolean append) throws IOException { |
|
|
|
boolean append) throws IOException { |
|
|
|
BufferedWriter fw = new BufferedWriter(new OutputStreamWriter( |
|
|
|
OutputStream fw = new SafeBufferedOutputStream(new FileOutputStream( |
|
|
|
new FileOutputStream(new File(repo.getDirectory(), path), |
|
|
|
new File(repo.getDirectory(), path), append)); |
|
|
|
append), Constants.CHARACTER_ENCODING)); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (RebaseTodoLine step : steps) { |
|
|
|
for (RebaseTodoLine step : steps) { |
|
|
@ -232,8 +231,8 @@ public class RebaseTodoFile { |
|
|
|
sb.append(" "); //$NON-NLS-1$
|
|
|
|
sb.append(" "); //$NON-NLS-1$
|
|
|
|
sb.append(step.getShortMessage().trim()); |
|
|
|
sb.append(step.getShortMessage().trim()); |
|
|
|
} |
|
|
|
} |
|
|
|
fw.write(sb.toString()); |
|
|
|
sb.append('\n'); |
|
|
|
fw.newLine(); |
|
|
|
fw.write(Constants.encode(sb.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
fw.close(); |
|
|
|
fw.close(); |
|
|
|