Browse Source

Remove uses of TextBuiltin.out in favor of outw

These came from patches in review in parallel with the introduction
of the exception throwing print writer.

Change-Id: I1c27fa276eb1fcf12ad19792049c35cb52518c16
stable-2.2
Robin Rosenberg 12 years ago
parent
commit
7de1154d21
  1. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java
  2. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  3. 28
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java

@ -87,7 +87,7 @@ class Merge extends TextBuiltin {
switch (result.getMergeStatus()) { switch (result.getMergeStatus()) {
case ALREADY_UP_TO_DATE: case ALREADY_UP_TO_DATE:
out.println(CLIText.get().alreadyUpToDate); outw.println(CLIText.get().alreadyUpToDate);
break; break;
case FAST_FORWARD: case FAST_FORWARD:
outw.println(result.getMergeStatus().toString()); outw.println(result.getMergeStatus().toString());

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java

@ -252,7 +252,7 @@ class Push extends TextBuiltin {
private void printUpdateLine(final char flag, final String summary, private void printUpdateLine(final char flag, final String summary,
final String srcRef, final String destRef, final String message) final String srcRef, final String destRef, final String message)
throws IOException { throws IOException {
out.format(" %c %-17s", valueOf(flag), summary); outw.format(" %c %-17s", valueOf(flag), summary);
if (srcRef != null) if (srcRef != null)
outw.format(" %s ->", abbreviateRef(srcRef, true)); outw.format(" %s ->", abbreviateRef(srcRef, true));

28
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java

@ -43,6 +43,7 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -69,10 +70,10 @@ class Status extends TextBuiltin {
boolean firstHeader = true; boolean firstHeader = true;
if (head != null && head.isSymbolic()) { if (head != null && head.isSymbolic()) {
String branch = Repository.shortenRefName(head.getLeaf().getName()); String branch = Repository.shortenRefName(head.getLeaf().getName());
out.println(CLIText.formatLine( outw.println(CLIText.formatLine(
MessageFormat.format(CLIText.get().onBranch, branch))); MessageFormat.format(CLIText.get().onBranch, branch)));
} else } else
out.println(CLIText.formatLine(CLIText.get().notOnAnyBranch)); outw.println(CLIText.formatLine(CLIText.get().notOnAnyBranch));
// List changes // List changes
org.eclipse.jgit.api.Status status = new Git(db).status().call(); org.eclipse.jgit.api.Status status = new Git(db).status().call();
Collection<String> added = status.getAdded(); Collection<String> added = status.getAdded();
@ -122,22 +123,24 @@ class Status extends TextBuiltin {
} }
} }
protected void printSectionHeader(String pattern, Object... arguments) { protected void printSectionHeader(String pattern, Object... arguments)
out.println(CLIText.formatLine(MessageFormat.format(pattern, arguments))); throws IOException {
outw.println(CLIText.formatLine(MessageFormat
.format(pattern, arguments)));
if (!pattern.equals("")) if (!pattern.equals(""))
out.println(CLIText.formatLine("")); outw.println(CLIText.formatLine(""));
out.flush(); outw.flush();
} }
protected int printList(Collection<String> list) { protected int printList(Collection<String> list) throws IOException {
if (!list.isEmpty()) { if (!list.isEmpty()) {
List<String> sortedList = new ArrayList<String>(list); List<String> sortedList = new ArrayList<String>(list);
java.util.Collections.sort(sortedList); java.util.Collections.sort(sortedList);
for (String filename : sortedList) { for (String filename : sortedList) {
out.println(CLIText.formatLine(String.format( outw.println(CLIText.formatLine(String.format(
statusFileListFormat, filename))); statusFileListFormat, filename)));
} }
out.flush(); outw.flush();
return list.size(); return list.size();
} else } else
return 0; return 0;
@ -146,7 +149,8 @@ class Status extends TextBuiltin {
protected int printList(String status1, String status2, String status3, protected int printList(String status1, String status2, String status3,
Collection<String> list, Collection<String> set1, Collection<String> list, Collection<String> set1,
Collection<String> set2, Collection<String> set2,
@SuppressWarnings("unused") Collection<String> set3) { @SuppressWarnings("unused") Collection<String> set3)
throws IOException {
List<String> sortedList = new ArrayList<String>(list); List<String> sortedList = new ArrayList<String>(list);
java.util.Collections.sort(sortedList); java.util.Collections.sort(sortedList);
for (String filename : sortedList) { for (String filename : sortedList) {
@ -158,9 +162,9 @@ class Status extends TextBuiltin {
else else
// if (set3.contains(filename)) // if (set3.contains(filename))
prefix = status3; prefix = status3;
out.println(CLIText.formatLine(String.format( outw.println(CLIText.formatLine(String.format(
statusFileListFormatWithPrefix, prefix, filename))); statusFileListFormatWithPrefix, prefix, filename)));
out.flush(); outw.flush();
} }
return list.size(); return list.size();
} }

Loading…
Cancel
Save