Browse Source

Mark non-externalizable strings as such

A few classes such as Constanrs are marked with @SuppressWarnings, as are
toString() methods with many liternal, but otherwise $NLS-n$ is used for
string containing text that should not be translated. A few literals may
fall into the gray zone, but mostly I've tried to only tag the obvious
ones.

Change-Id: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590
stable-2.3
Robin Rosenberg 12 years ago
parent
commit
c310fa0c80
  1. 8
      org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java
  2. 12
      org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java
  3. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
  4. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
  5. 62
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java
  6. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java
  7. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  8. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
  9. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
  10. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java
  11. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java
  12. 16
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
  13. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
  14. 24
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
  15. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  16. 24
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
  17. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java
  18. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  19. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java
  20. 22
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
  21. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
  22. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
  23. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
  24. 7
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
  25. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
  26. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
  27. 12
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  28. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
  29. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
  30. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
  31. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
  32. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
  33. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
  34. 2
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java
  35. 6
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java
  36. 13
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
  37. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
  38. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
  39. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
  40. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
  41. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
  42. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
  43. 24
      org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
  44. 26
      org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java
  45. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java
  46. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
  47. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java
  48. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java
  49. 14
      org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
  50. 1
      org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java
  51. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
  52. 1
      org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java
  53. 80
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
  54. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java
  55. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
  56. 10
      org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
  57. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
  58. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java
  59. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java
  60. 2
      org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java
  61. 2
      org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java
  62. 5
      org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java
  63. 16
      org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java
  64. 3
      org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
  65. 56
      org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
  66. 1
      org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
  67. 2
      org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java
  68. 6
      org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
  69. 4
      org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
  70. 6
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
  71. 2
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
  72. 12
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
  73. 1
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
  74. 2
      org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java
  75. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java
  76. 6
      org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java
  77. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java
  78. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/PackProtocolException.java
  79. 2
      org.eclipse.jgit/src/org/eclipse/jgit/errors/RevisionSyntaxException.java
  80. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleLoadingException.java
  81. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationStringMissingException.java
  82. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/TransportException.java
  83. 2
      org.eclipse.jgit/src/org/eclipse/jgit/errors/UnsupportedCredentialItem.java
  84. 1
      org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerHandle.java
  85. 1
      org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java
  86. 10
      org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
  87. 34
      org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java
  88. 2
      org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java
  89. 24
      org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java
  90. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
  91. 1
      org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
  92. 6
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
  93. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java
  94. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java
  95. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java
  96. 11
      org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java
  97. 38
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
  98. 1
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
  99. 1
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java
  100. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java
  101. Some files were not shown because too many files have changed in this diff Show More

8
org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java

@ -66,11 +66,11 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
@Override @Override
protected PasswordAuthentication promptPasswordAuthentication() { protected PasswordAuthentication promptPasswordAuthentication() {
final String realm = formatRealm(); final String realm = formatRealm();
String username = cons.readLine(MessageFormat.format(ConsoleText.get().usernameFor + " ", realm)); String username = cons.readLine(MessageFormat.format(ConsoleText.get().usernameFor + " ", realm)); //$NON-NLS-1$
if (username == null || username.isEmpty()) { if (username == null || username.isEmpty()) {
return null; return null;
} }
char[] password = cons.readPassword(ConsoleText.get().password + " "); char[] password = cons.readPassword(ConsoleText.get().password + " "); //$NON-NLS-1$
if (password == null) { if (password == null) {
password = new char[0]; password = new char[0];
} }
@ -81,10 +81,10 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
final StringBuilder realm = new StringBuilder(); final StringBuilder realm = new StringBuilder();
if (getRequestorType() == RequestorType.PROXY) { if (getRequestorType() == RequestorType.PROXY) {
realm.append(getRequestorType()); realm.append(getRequestorType());
realm.append(" "); realm.append(" "); //$NON-NLS-1$
realm.append(getRequestingHost()); realm.append(getRequestingHost());
if (getRequestingPort() > 0) { if (getRequestingPort() > 0) {
realm.append(":"); realm.append(":"); //$NON-NLS-1$
realm.append(getRequestingPort()); realm.append(getRequestingPort());
} }
} else { } else {

12
org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java

@ -118,7 +118,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
private boolean get(CredentialItem.StringType item) { private boolean get(CredentialItem.StringType item) {
if (item.isValueSecure()) { if (item.isValueSecure()) {
char[] v = cons.readPassword("%s: ", item.getPromptText()); char[] v = cons.readPassword("%s: ", item.getPromptText()); //$NON-NLS-1$
if (v != null) { if (v != null) {
item.setValue(new String(v)); item.setValue(new String(v));
return true; return true;
@ -126,7 +126,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
return false; return false;
} }
} else { } else {
String v = cons.readLine("%s: ", item.getPromptText()); String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$
if (v != null) { if (v != null) {
item.setValue(v); item.setValue(v);
return true; return true;
@ -138,7 +138,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
private boolean get(CredentialItem.CharArrayType item) { private boolean get(CredentialItem.CharArrayType item) {
if (item.isValueSecure()) { if (item.isValueSecure()) {
char[] v = cons.readPassword("%s: ", item.getPromptText()); char[] v = cons.readPassword("%s: ", item.getPromptText()); //$NON-NLS-1$
if (v != null) { if (v != null) {
item.setValueNoCopy(v); item.setValueNoCopy(v);
return true; return true;
@ -146,7 +146,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
return false; return false;
} }
} else { } else {
String v = cons.readLine("%s: ", item.getPromptText()); String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$
if (v != null) { if (v != null) {
item.setValueNoCopy(v.toCharArray()); item.setValueNoCopy(v.toCharArray());
return true; return true;
@ -157,13 +157,13 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
} }
private boolean get(CredentialItem.InformationalMessage item) { private boolean get(CredentialItem.InformationalMessage item) {
cons.printf("%s\n", item.getPromptText()); cons.printf("%s\n", item.getPromptText()); //$NON-NLS-1$
cons.flush(); cons.flush();
return true; return true;
} }
private boolean get(CredentialItem.YesNoType item) { private boolean get(CredentialItem.YesNoType item) {
String r = cons.readLine("%s [%s/%s]? ", item.getPromptText(), String r = cons.readLine("%s [%s/%s]? ", item.getPromptText(), //$NON-NLS-1$
ConsoleText.get().answerYes, ConsoleText.get().answerNo); ConsoleText.get().answerYes, ConsoleText.get().answerNo);
if (r != null) { if (r != null) {
item.setValue(ConsoleText.get().answerYes.equalsIgnoreCase(r)); item.setValue(ConsoleText.get().answerYes.equalsIgnoreCase(r));

8
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java

@ -84,7 +84,7 @@ abstract class AbstractFetchCommand extends TextBuiltin {
shownURI = true; shownURI = true;
} }
outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType, outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType, //$NON-NLS-1$
src, dst); src, dst);
outw.println(); outw.println();
} }
@ -150,18 +150,18 @@ abstract class AbstractFetchCommand extends TextBuiltin {
if (r == RefUpdate.Result.FORCED) { if (r == RefUpdate.Result.FORCED) {
final String aOld = safeAbbreviate(reader, u.getOldObjectId()); final String aOld = safeAbbreviate(reader, u.getOldObjectId());
final String aNew = safeAbbreviate(reader, u.getNewObjectId()); final String aNew = safeAbbreviate(reader, u.getNewObjectId());
return aOld + "..." + aNew; return aOld + "..." + aNew; //$NON-NLS-1$
} }
if (r == RefUpdate.Result.FAST_FORWARD) { if (r == RefUpdate.Result.FAST_FORWARD) {
final String aOld = safeAbbreviate(reader, u.getOldObjectId()); final String aOld = safeAbbreviate(reader, u.getOldObjectId());
final String aNew = safeAbbreviate(reader, u.getNewObjectId()); final String aNew = safeAbbreviate(reader, u.getNewObjectId());
return aOld + ".." + aNew; return aOld + ".." + aNew; //$NON-NLS-1$
} }
if (r == RefUpdate.Result.NO_CHANGE) if (r == RefUpdate.Result.NO_CHANGE)
return "[up to date]"; return "[up to date]";
return "[" + r.name() + "]"; return "[" + r.name() + "]"; //$NON-NLS-1$//$NON-NLS-2$
} }
private String safeAbbreviate(ObjectReader reader, ObjectId id) { private String safeAbbreviate(ObjectReader reader, ObjectId id) {

8
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java

@ -83,7 +83,7 @@ class AmazonS3Client extends TextBuiltin {
protected void run() throws Exception { protected void run() throws Exception {
final AmazonS3 s3 = new AmazonS3(properties()); final AmazonS3 s3 = new AmazonS3(properties());
if ("get".equals(op)) { if ("get".equals(op)) { //$NON-NLS-1$
final URLConnection c = s3.get(bucket, key); final URLConnection c = s3.get(bucket, key);
int len = c.getContentLength(); int len = c.getContentLength();
final InputStream in = c.getInputStream(); final InputStream in = c.getInputStream();
@ -104,14 +104,14 @@ class AmazonS3Client extends TextBuiltin {
in.close(); in.close();
} }
} else if ("ls".equals(op) || "list".equals(op)) { } else if ("ls".equals(op) || "list".equals(op)) { //$NON-NLS-1$//$NON-NLS-2$
for (final String k : s3.list(bucket, key)) for (final String k : s3.list(bucket, key))
outw.println(k); outw.println(k);
} else if ("rm".equals(op) || "delete".equals(op)) { } else if ("rm".equals(op) || "delete".equals(op)) { //$NON-NLS-1$ //$NON-NLS-2$
s3.delete(bucket, key); s3.delete(bucket, key);
} else if ("put".equals(op)) { } else if ("put".equals(op)) { //$NON-NLS-1$
final OutputStream os = s3.beginPut(bucket, key, null, null); final OutputStream os = s3.beginPut(bucket, key, null, null);
final byte[] tmp = new byte[2048]; final byte[] tmp = new byte[2048];
int n; int n;

62
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java

@ -143,16 +143,16 @@ class Blame extends TextBuiltin {
} }
if (abbrev == 0) if (abbrev == 0)
abbrev = db.getConfig().getInt("core", "abbrev", 7); abbrev = db.getConfig().getInt("core", "abbrev", 7); //$NON-NLS-1$ //$NON-NLS-2$
if (!showBlankBoundary) if (!showBlankBoundary)
root = db.getConfig().getBoolean("blame", "blankboundary", false); root = db.getConfig().getBoolean("blame", "blankboundary", false); //$NON-NLS-1$ //$NON-NLS-2$
if (!root) if (!root)
root = db.getConfig().getBoolean("blame", "showroot", false); root = db.getConfig().getBoolean("blame", "showroot", false); //$NON-NLS-1$ //$NON-NLS-2$
if (showRawTimestamp) if (showRawTimestamp)
dateFmt = new SimpleDateFormat("ZZZZ"); dateFmt = new SimpleDateFormat("ZZZZ"); //$NON-NLS-1$
else else
dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZZ"); dateFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZZZ"); //$NON-NLS-1$
BlameGenerator generator = new BlameGenerator(db, file); BlameGenerator generator = new BlameGenerator(db, file);
reader = db.newObjectReader(); reader = db.newObjectReader();
@ -170,7 +170,7 @@ class Blame extends TextBuiltin {
} }
generator.reverse(rangeStart, rangeEnd); generator.reverse(rangeStart, rangeEnd);
} else if (revision != null) { } else if (revision != null) {
generator.push(null, db.resolve(revision + "^{commit}")); generator.push(null, db.resolve(revision + "^{commit}")); //$NON-NLS-1$
} else { } else {
generator.push(null, db.resolve(Constants.HEAD)); generator.push(null, db.resolve(Constants.HEAD));
if (!db.isBare()) { if (!db.isBare()) {
@ -203,12 +203,12 @@ class Blame extends TextBuiltin {
maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line)); maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line));
} }
String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); //$NON-NLS-1$
String numFmt = MessageFormat.format(" %{0}d", String numFmt = MessageFormat.format(" %{0}d", //$NON-NLS-1$
valueOf(1 + (int) Math.log10(maxSourceLine + 1))); valueOf(1 + (int) Math.log10(maxSourceLine + 1)));
String lineFmt = MessageFormat.format(" %{0}d) ", String lineFmt = MessageFormat.format(" %{0}d) ", //$NON-NLS-1$
valueOf(1 + (int) Math.log10(end + 1))); valueOf(1 + (int) Math.log10(end + 1)));
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$
valueOf(authorWidth), valueOf(dateWidth)); valueOf(authorWidth), valueOf(dateWidth));
for (int line = begin; line < end; line++) { for (int line = begin; line < end; line++) {
@ -233,8 +233,8 @@ class Blame extends TextBuiltin {
private void parseLineRangeOption() { private void parseLineRangeOption() {
String beginStr, endStr; String beginStr, endStr;
if (rangeString.startsWith("/")) { if (rangeString.startsWith("/")) { //$NON-NLS-1$
int c = rangeString.indexOf("/,", 1); int c = rangeString.indexOf("/,", 1); //$NON-NLS-1$
if (c < 0) { if (c < 0) {
beginStr = rangeString; beginStr = rangeString;
endStr = String.valueOf(end); endStr = String.valueOf(end);
@ -249,7 +249,7 @@ class Blame extends TextBuiltin {
beginStr = rangeString; beginStr = rangeString;
endStr = String.valueOf(end); endStr = String.valueOf(end);
} else if (c == 0) { } else if (c == 0) {
beginStr = "0"; beginStr = "0"; //$NON-NLS-1$
endStr = rangeString.substring(1); endStr = rangeString.substring(1);
} else { } else {
beginStr = rangeString.substring(0, c); beginStr = rangeString.substring(0, c);
@ -257,20 +257,20 @@ class Blame extends TextBuiltin {
} }
} }
if (beginStr.equals("")) if (beginStr.equals("")) //$NON-NLS-1$
begin = 0; begin = 0;
else if (beginStr.startsWith("/")) else if (beginStr.startsWith("/")) //$NON-NLS-1$
begin = findLine(0, beginStr); begin = findLine(0, beginStr);
else else
begin = Math.max(0, Integer.parseInt(beginStr) - 1); begin = Math.max(0, Integer.parseInt(beginStr) - 1);
if (endStr.equals("")) if (endStr.equals("")) //$NON-NLS-1$
end = blame.getResultContents().size(); end = blame.getResultContents().size();
else if (endStr.startsWith("/")) else if (endStr.startsWith("/")) //$NON-NLS-1$
end = findLine(begin, endStr); end = findLine(begin, endStr);
else if (endStr.startsWith("-")) else if (endStr.startsWith("-")) //$NON-NLS-1$
end = begin + Integer.parseInt(endStr); end = begin + Integer.parseInt(endStr);
else if (endStr.startsWith("+")) else if (endStr.startsWith("+")) //$NON-NLS-1$
end = begin + Integer.parseInt(endStr.substring(1)); end = begin + Integer.parseInt(endStr.substring(1));
else else
end = Math.max(0, Integer.parseInt(endStr) - 1); end = Math.max(0, Integer.parseInt(endStr) - 1);
@ -278,10 +278,10 @@ class Blame extends TextBuiltin {
private int findLine(int b, String regex) { private int findLine(int b, String regex) {
String re = regex.substring(1, regex.length() - 1); String re = regex.substring(1, regex.length() - 1);
if (!re.startsWith("^")) if (!re.startsWith("^")) //$NON-NLS-1$
re = ".*" + re; re = ".*" + re; //$NON-NLS-1$
if (!re.endsWith("$")) if (!re.endsWith("$")) //$NON-NLS-1$
re = re + ".*"; re = re + ".*"; //$NON-NLS-1$
Pattern p = Pattern.compile(re); Pattern p = Pattern.compile(re);
RawText text = blame.getResultContents(); RawText text = blame.getResultContents();
for (int line = b; line < text.size(); line++) { for (int line = b; line < text.size(); line++) {
@ -293,30 +293,30 @@ class Blame extends TextBuiltin {
private String path(int line) { private String path(int line) {
String p = blame.getSourcePath(line); String p = blame.getSourcePath(line);
return p != null ? p : ""; return p != null ? p : ""; //$NON-NLS-1$
} }
private String author(int line) { private String author(int line) {
PersonIdent author = blame.getSourceAuthor(line); PersonIdent author = blame.getSourceAuthor(line);
if (author == null) if (author == null)
return ""; return ""; //$NON-NLS-1$
String name = showAuthorEmail ? author.getEmailAddress() : author String name = showAuthorEmail ? author.getEmailAddress() : author
.getName(); .getName();
return name != null ? name : ""; return name != null ? name : ""; //$NON-NLS-1$
} }
private String date(int line) { private String date(int line) {
if (blame.getSourceCommit(line) == null) if (blame.getSourceCommit(line) == null)
return ""; return ""; //$NON-NLS-1$
PersonIdent author = blame.getSourceAuthor(line); PersonIdent author = blame.getSourceAuthor(line);
if (author == null) if (author == null)
return ""; return ""; //$NON-NLS-1$
dateFmt.setTimeZone(author.getTimeZone()); dateFmt.setTimeZone(author.getTimeZone());
if (!showRawTimestamp) if (!showRawTimestamp)
return dateFmt.format(author.getWhen()); return dateFmt.format(author.getWhen());
return String.format("%d %s", return String.format("%d %s", //$NON-NLS-1$
valueOf(author.getWhen().getTime() / 1000L), valueOf(author.getWhen().getTime() / 1000L),
dateFmt.format(author.getWhen())); dateFmt.format(author.getWhen()));
} }
@ -338,9 +338,9 @@ class Blame extends TextBuiltin {
} else if (!root && commit.getParentCount() == 0) { } else if (!root && commit.getParentCount() == 0) {
if (showLongRevision) if (showLongRevision)
r = "^" + commit.name().substring(0, OBJECT_ID_STRING_LENGTH - 1); r = "^" + commit.name().substring(0, OBJECT_ID_STRING_LENGTH - 1); //$NON-NLS-1$
else else
r = "^" + reader.abbreviate(commit, abbrev).name(); r = "^" + reader.abbreviate(commit, abbrev).name(); //$NON-NLS-1$
} else { } else {
if (showLongRevision) if (showLongRevision)
r = commit.name(); r = commit.name();

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java

@ -145,7 +145,7 @@ class Branch extends TextBuiltin {
else else
startBranch = Constants.HEAD; startBranch = Constants.HEAD;
Ref startRef = db.getRef(startBranch); Ref startRef = db.getRef(startBranch);
ObjectId startAt = db.resolve(startBranch + "^0"); ObjectId startAt = db.resolve(startBranch + "^0"); //$NON-NLS-1$
if (startRef != null) if (startRef != null)
startBranch = startRef.getName(); startBranch = startRef.getName();
else else
@ -180,7 +180,7 @@ class Branch extends TextBuiltin {
if (head != null) { if (head != null) {
String current = head.getLeaf().getName(); String current = head.getLeaf().getName();
if (current.equals(Constants.HEAD)) if (current.equals(Constants.HEAD))
addRef("(no branch)", head); addRef("(no branch)", head); //$NON-NLS-1$
addRefs(refs, Constants.R_HEADS, !remote); addRefs(refs, Constants.R_HEADS, !remote);
addRefs(refs, Constants.R_REMOTES, remote); addRefs(refs, Constants.R_REMOTES, remote);
@ -220,7 +220,7 @@ class Branch extends TextBuiltin {
outw.print(ref); outw.print(ref);
if (verbose) { if (verbose) {
final int spaces = maxNameLength - ref.length() + 1; final int spaces = maxNameLength - ref.length() + 1;
outw.format("%" + spaces + "s", ""); outw.format("%" + spaces + "s", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
final ObjectId objectId = refObj.getObjectId(); final ObjectId objectId = refObj.getObjectId();
outw.print(reader.abbreviate(objectId).name()); outw.print(reader.abbreviate(objectId).name());
outw.print(' '); outw.print(' ');

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java

@ -110,7 +110,7 @@ class Clone extends AbstractFetchCommand {
dst = new FileRepository(gitdir); dst = new FileRepository(gitdir);
dst.create(); dst.create();
final FileBasedConfig dstcfg = dst.getConfig(); final FileBasedConfig dstcfg = dst.getConfig();
dstcfg.setBoolean("core", null, "bare", false); dstcfg.setBoolean("core", null, "bare", false); //$NON-NLS-1$ //$NON-NLS-2$
dstcfg.save(); dstcfg.save();
db = dst; db = dst;
@ -131,8 +131,8 @@ class Clone extends AbstractFetchCommand {
final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName); final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName);
rc.addURI(uri); rc.addURI(uri);
rc.addFetchRefSpec(new RefSpec().setForceUpdate(true) rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)
.setSourceDestination(Constants.R_HEADS + "*", .setSourceDestination(Constants.R_HEADS + "*", //$NON-NLS-1$
Constants.R_REMOTES + remoteName + "/*")); Constants.R_REMOTES + remoteName + "/*")); //$NON-NLS-1$
rc.update(dstcfg); rc.update(dstcfg);
dstcfg.save(); dstcfg.save();
} }

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java

@ -132,7 +132,7 @@ public class CommandCatalog {
private Enumeration<URL> catalogs() { private Enumeration<URL> catalogs() {
try { try {
final String pfx = "META-INF/services/"; final String pfx = "META-INF/services/"; //$NON-NLS-1$
return ldr.getResources(pfx + TextBuiltin.class.getName()); return ldr.getResources(pfx + TextBuiltin.class.getName());
} catch (IOException err) { } catch (IOException err) {
return new Vector<URL>().elements(); return new Vector<URL>().elements();
@ -143,7 +143,7 @@ public class CommandCatalog {
final BufferedReader cIn; final BufferedReader cIn;
try { try {
final InputStream in = cUrl.openStream(); final InputStream in = cUrl.openStream();
cIn = new BufferedReader(new InputStreamReader(in, "UTF-8")); cIn = new BufferedReader(new InputStreamReader(in, "UTF-8")); //$NON-NLS-1$
} catch (IOException err) { } catch (IOException err) {
// If we cannot read from the service list, go to the next. // If we cannot read from the service list, go to the next.
// //
@ -153,7 +153,7 @@ public class CommandCatalog {
try { try {
String line; String line;
while ((line = cIn.readLine()) != null) { while ((line = cIn.readLine()) != null) {
if (line.length() > 0 && !line.startsWith("#")) if (line.length() > 0 && !line.startsWith("#")) //$NON-NLS-1$
load(line); load(line);
} }
} catch (IOException err) { } catch (IOException err) {

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java

@ -76,13 +76,13 @@ public class CommandRef {
private CommandRef(final Class<? extends TextBuiltin> clazz, final String cn) { private CommandRef(final Class<? extends TextBuiltin> clazz, final String cn) {
impl = clazz; impl = clazz;
name = cn; name = cn;
usage = ""; usage = ""; //$NON-NLS-1$
} }
private static String guessName(final Class<? extends TextBuiltin> clazz) { private static String guessName(final Class<? extends TextBuiltin> clazz) {
final StringBuilder s = new StringBuilder(); final StringBuilder s = new StringBuilder();
if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) //$NON-NLS-1$
s.append("debug-"); s.append("debug-"); //$NON-NLS-1$
boolean lastWasDash = true; boolean lastWasDash = true;
for (final char c : clazz.getSimpleName().toCharArray()) { for (final char c : clazz.getSimpleName().toCharArray()) {

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

@ -109,7 +109,7 @@ class Commit extends TextBuiltin {
if (branchName.startsWith(Constants.R_HEADS)) if (branchName.startsWith(Constants.R_HEADS))
branchName = branchName.substring(Constants.R_HEADS.length()); branchName = branchName.substring(Constants.R_HEADS.length());
} }
outw.println("[" + branchName + " " + commit.name() + "] " outw.println("[" + branchName + " " + commit.name() + "] " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ commit.getShortMessage()); + commit.getShortMessage());
} }
} }

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java

@ -103,7 +103,7 @@ class Config extends TextBuiltin {
Set<String> names = config.getNames(section); Set<String> names = config.getNames(section);
for (String name : names) { for (String name : names) {
for (String value : config.getStringList(section, null, name)) for (String value : config.getStringList(section, null, name))
outw.println(section + "." + name + "=" + value); outw.println(section + "." + name + "=" + value); //$NON-NLS-1$ //$NON-NLS-2$
} }
if (names.isEmpty()) { if (names.isEmpty()) {
for (String subsection : config.getSubsections(section)) { for (String subsection : config.getSubsections(section)) {
@ -111,8 +111,8 @@ class Config extends TextBuiltin {
for (String name : names) { for (String name : names) {
for (String value : config.getStringList(section, for (String value : config.getStringList(section,
subsection, name)) subsection, name))
outw.println(section + "." + subsection + "." outw.println(section + "." + subsection + "." //$NON-NLS-1$ //$NON-NLS-2$
+ name + "=" + value); + name + "=" + value); //$NON-NLS-1$
} }
} }
} }

16
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java

@ -161,8 +161,8 @@ class Diff extends TextBuiltin {
@Option(name = "--no-prefix", usage = "usage_noPrefix") @Option(name = "--no-prefix", usage = "usage_noPrefix")
void noPrefix(@SuppressWarnings("unused") boolean on) { void noPrefix(@SuppressWarnings("unused") boolean on) {
diffFmt.setOldPrefix(""); diffFmt.setOldPrefix(""); //$NON-NLS-1$
diffFmt.setNewPrefix(""); diffFmt.setNewPrefix(""); //$NON-NLS-1$
} }
// END -- Options shared with Log // END -- Options shared with Log
@ -179,7 +179,7 @@ class Diff extends TextBuiltin {
try { try {
if (cached) { if (cached) {
if (oldTree == null) { if (oldTree == null) {
ObjectId head = db.resolve(HEAD + "^{tree}"); ObjectId head = db.resolve(HEAD + "^{tree}"); //$NON-NLS-1$
if (head == null) if (head == null)
die(MessageFormat.format(CLIText.get().notATree, HEAD)); die(MessageFormat.format(CLIText.get().notATree, HEAD));
CanonicalTreeParser p = new CanonicalTreeParser(); CanonicalTreeParser p = new CanonicalTreeParser();
@ -227,21 +227,21 @@ class Diff extends TextBuiltin {
for (DiffEntry ent : files) { for (DiffEntry ent : files) {
switch (ent.getChangeType()) { switch (ent.getChangeType()) {
case ADD: case ADD:
out.println("A\t" + ent.getNewPath()); out.println("A\t" + ent.getNewPath()); //$NON-NLS-1$
break; break;
case DELETE: case DELETE:
out.println("D\t" + ent.getOldPath()); out.println("D\t" + ent.getOldPath()); //$NON-NLS-1$
break; break;
case MODIFY: case MODIFY:
out.println("M\t" + ent.getNewPath()); out.println("M\t" + ent.getNewPath()); //$NON-NLS-1$
break; break;
case COPY: case COPY:
out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$
ent.getOldPath(), ent.getNewPath()); ent.getOldPath(), ent.getNewPath());
out.println(); out.println();
break; break;
case RENAME: case RENAME:
out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$
ent.getOldPath(), ent.getNewPath()); ent.getOldPath(), ent.getNewPath());
out.println(); out.println();
break; break;

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

@ -104,7 +104,7 @@ class Glog extends RevWalkTextBuiltin {
graphPane.getCommitList().source(walk); graphPane.getCommitList().source(walk);
graphPane.getCommitList().fillTo(Integer.MAX_VALUE); graphPane.getCommitList().fillTo(Integer.MAX_VALUE);
frame.setTitle("[" + repoName() + "]"); frame.setTitle("[" + repoName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
frame.pack(); frame.pack();
frame.setVisible(true); frame.setVisible(true);
return graphPane.getCommitList().size(); return graphPane.getCommitList().size();

24
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java

@ -171,8 +171,8 @@ class Log extends RevWalkTextBuiltin {
@Option(name = "--no-prefix", usage = "usage_noPrefix") @Option(name = "--no-prefix", usage = "usage_noPrefix")
void noPrefix(@SuppressWarnings("unused") boolean on) { void noPrefix(@SuppressWarnings("unused") boolean on) {
diffFmt.setOldPrefix(""); diffFmt.setOldPrefix(""); //$NON-NLS-1$
diffFmt.setNewPrefix(""); diffFmt.setNewPrefix(""); //$NON-NLS-1$
} }
// END -- Options shared with Diff // END -- Options shared with Diff
@ -238,18 +238,18 @@ class Log extends RevWalkTextBuiltin {
@Override @Override
protected void show(final RevCommit c) throws Exception { protected void show(final RevCommit c) throws Exception {
outw.print(CLIText.get().commitLabel); outw.print(CLIText.get().commitLabel);
outw.print(" "); outw.print(" "); //$NON-NLS-1$
c.getId().copyTo(outbuffer, outw); c.getId().copyTo(outbuffer, outw);
if (decorate) { if (decorate) {
Collection<Ref> list = allRefsByPeeledObjectId.get(c); Collection<Ref> list = allRefsByPeeledObjectId.get(c);
if (list != null) { if (list != null) {
outw.print(" ("); outw.print(" ("); //$NON-NLS-1$
for (Iterator<Ref> i = list.iterator(); i.hasNext(); ) { for (Iterator<Ref> i = list.iterator(); i.hasNext(); ) {
outw.print(i.next().getName()); outw.print(i.next().getName());
if (i.hasNext()) if (i.hasNext())
outw.print(" "); outw.print(" "); //$NON-NLS-1$
} }
outw.print(")"); outw.print(")"); //$NON-NLS-1$
} }
} }
outw.println(); outw.println();
@ -260,9 +260,9 @@ class Log extends RevWalkTextBuiltin {
dateFormatter.formatDate(author))); dateFormatter.formatDate(author)));
outw.println(); outw.println();
final String[] lines = c.getFullMessage().split("\n"); final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$
for (final String s : lines) { for (final String s : lines) {
outw.print(" "); outw.print(" "); //$NON-NLS-1$
outw.print(s); outw.print(s);
outw.println(); outw.println();
} }
@ -324,16 +324,16 @@ class Log extends RevWalkTextBuiltin {
outw.println(); outw.println();
outw.print("Notes"); outw.print("Notes");
if (label != null) { if (label != null) {
outw.print(" ("); outw.print(" ("); //$NON-NLS-1$
outw.print(label); outw.print(label);
outw.print(")"); outw.print(")"); //$NON-NLS-1$
} }
outw.println(":"); outw.println(":"); //$NON-NLS-1$
try { try {
RawText rawText = new RawText(argWalk.getObjectReader() RawText rawText = new RawText(argWalk.getObjectReader()
.open(blobId).getCachedBytes(Integer.MAX_VALUE)); .open(blobId).getCachedBytes(Integer.MAX_VALUE));
for (int i = 0; i < rawText.size(); i++) { for (int i = 0; i < rawText.size(); i++) {
outw.print(" "); outw.print(" "); //$NON-NLS-1$
outw.println(rawText.getString(i)); outw.println(rawText.getString(i));
} }
} catch (LargeObjectException e) { } catch (LargeObjectException e) {

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

@ -71,7 +71,7 @@ class LsRemote extends TextBuiltin {
for (final Ref r : c.getRefs()) { for (final Ref r : c.getRefs()) {
show(r.getObjectId(), r.getName()); show(r.getObjectId(), r.getName());
if (r.getPeeledObjectId() != null) if (r.getPeeledObjectId() != null)
show(r.getPeeledObjectId(), r.getName() + "^{}"); show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
} }
} finally { } finally {
c.close(); c.close();

24
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java

@ -128,7 +128,7 @@ public class Main {
&& err instanceof TransportException) && err instanceof TransportException)
System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage())); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage()));
if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { //$NON-NLS-1$
System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
if (showStackTrace) if (showStackTrace)
err.printStackTrace(); err.printStackTrace();
@ -163,7 +163,7 @@ public class Main {
if (argv.length == 0 || help) { if (argv.length == 0 || help) {
final String ex = clp.printExample(ExampleMode.ALL, CLIText.get().resourceBundle()); final String ex = clp.printExample(ExampleMode.ALL, CLIText.get().resourceBundle());
writer.println("jgit" + ex + " command [ARG ...]"); writer.println("jgit" + ex + " command [ARG ...]"); //$NON-NLS-1$
if (help) { if (help) {
writer.println(); writer.println();
clp.printUsage(writer, CLIText.get().resourceBundle()); clp.printUsage(writer, CLIText.get().resourceBundle());
@ -226,8 +226,8 @@ public class Main {
private static boolean installConsole() { private static boolean installConsole() {
try { try {
install("org.eclipse.jgit.console.ConsoleAuthenticator"); install("org.eclipse.jgit.console.ConsoleAuthenticator"); //$NON-NLS-1$
install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); //$NON-NLS-1$
return true; return true;
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
return false; return false;
@ -253,7 +253,7 @@ public class Main {
throws IllegalAccessException, InvocationTargetException, throws IllegalAccessException, InvocationTargetException,
NoSuchMethodException, ClassNotFoundException { NoSuchMethodException, ClassNotFoundException {
try { try {
Class.forName(name).getMethod("install").invoke(null); Class.forName(name).getMethod("install").invoke(null); //$NON-NLS-1$
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
if (e.getCause() instanceof RuntimeException) if (e.getCause() instanceof RuntimeException)
throw (RuntimeException) e.getCause(); throw (RuntimeException) e.getCause();
@ -276,23 +276,23 @@ public class Main {
* the value in <code>http_proxy</code> is unsupportable. * the value in <code>http_proxy</code> is unsupportable.
*/ */
private static void configureHttpProxy() throws MalformedURLException { private static void configureHttpProxy() throws MalformedURLException {
final String s = System.getenv("http_proxy"); final String s = System.getenv("http_proxy"); //$NON-NLS-1$
if (s == null || s.equals("")) if (s == null || s.equals("")) //$NON-NLS-1$
return; return;
final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$
if (!"http".equals(u.getProtocol())) if (!"http".equals(u.getProtocol())) //$NON-NLS-1$
throw new MalformedURLException(MessageFormat.format(CLIText.get().invalidHttpProxyOnlyHttpSupported, s)); throw new MalformedURLException(MessageFormat.format(CLIText.get().invalidHttpProxyOnlyHttpSupported, s));
final String proxyHost = u.getHost(); final String proxyHost = u.getHost();
final int proxyPort = u.getPort(); final int proxyPort = u.getPort();
System.setProperty("http.proxyHost", proxyHost); System.setProperty("http.proxyHost", proxyHost); //$NON-NLS-1$
if (proxyPort > 0) if (proxyPort > 0)
System.setProperty("http.proxyPort", String.valueOf(proxyPort)); System.setProperty("http.proxyPort", String.valueOf(proxyPort)); //$NON-NLS-1$
final String userpass = u.getUserInfo(); final String userpass = u.getUserInfo();
if (userpass != null && userpass.contains(":")) { if (userpass != null && userpass.contains(":")) { //$NON-NLS-1$
final int c = userpass.indexOf(':'); final int c = userpass.indexOf(':');
final String user = userpass.substring(0, c); final String user = userpass.substring(0, c);
final String pass = userpass.substring(c + 1); final String pass = userpass.substring(c + 1);

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

@ -103,7 +103,7 @@ class Merge extends TextBuiltin {
// determine the other revision we want to merge with HEAD // determine the other revision we want to merge with HEAD
final Ref srcRef = db.getRef(ref); final Ref srcRef = db.getRef(ref);
final ObjectId src = db.resolve(ref + "^{commit}"); final ObjectId src = db.resolve(ref + "^{commit}"); //$NON-NLS-1$
if (src == null) if (src == null)
throw die(MessageFormat.format( throw die(MessageFormat.format(
CLIText.get().refDoesNotExistOrNoCommit, ref)); CLIText.get().refDoesNotExistOrNoCommit, ref));
@ -144,11 +144,11 @@ class Merge extends TextBuiltin {
case DIRTY_WORKTREE: case DIRTY_WORKTREE:
case DIRTY_INDEX: case DIRTY_INDEX:
outw.println(CLIText.get().dontOverwriteLocalChanges); outw.println(CLIText.get().dontOverwriteLocalChanges);
outw.println(" " + entry.getKey()); outw.println(" " + entry.getKey()); //$NON-NLS-1$
break; break;
case COULD_NOT_DELETE: case COULD_NOT_DELETE:
outw.println(CLIText.get().cannotDeleteFile); outw.println(CLIText.get().cannotDeleteFile);
outw.println(" " + entry.getKey()); outw.println(" " + entry.getKey()); //$NON-NLS-1$
break; break;
} }
break; break;
@ -157,7 +157,7 @@ class Merge extends TextBuiltin {
if (!isMergedInto(oldHead, src)) if (!isMergedInto(oldHead, src))
name = mergeStrategy.getName(); name = mergeStrategy.getName();
else else
name = "recursive"; name = "recursive"; //$NON-NLS-1$
outw.println(MessageFormat.format(CLIText.get().mergeMadeBy, name)); outw.println(MessageFormat.format(CLIText.get().mergeMadeBy, name));
break; break;
case MERGED_SQUASHED: case MERGED_SQUASHED:

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

@ -194,7 +194,7 @@ class Push extends TextBuiltin {
final char flag = fastForward ? ' ' : '+'; final char flag = fastForward ? ' ' : '+';
final String summary = safeAbbreviate(reader, oldRef final String summary = safeAbbreviate(reader, oldRef
.getObjectId()) .getObjectId())
+ (fastForward ? ".." : "...") + (fastForward ? ".." : "...") //$NON-NLS-1$ //$NON-NLS-2$
+ safeAbbreviate(reader, rru.getNewObjectId()); + safeAbbreviate(reader, rru.getNewObjectId());
final String message = fastForward ? null : CLIText.get().forcedUpdate; final String message = fastForward ? null : CLIText.get().forcedUpdate;
printUpdateLine(flag, summary, srcRef, remoteName, message); printUpdateLine(flag, summary, srcRef, remoteName, message);
@ -252,14 +252,14 @@ 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 {
outw.format(" %c %-17s", valueOf(flag), summary); outw.format(" %c %-17s", valueOf(flag), summary); //$NON-NLS-1$
if (srcRef != null) if (srcRef != null)
outw.format(" %s ->", abbreviateRef(srcRef, true)); outw.format(" %s ->", abbreviateRef(srcRef, true)); //$NON-NLS-1$
outw.format(" %s", abbreviateRef(destRef, true)); outw.format(" %s", abbreviateRef(destRef, true)); //$NON-NLS-1$
if (message != null) if (message != null)
outw.format(" (%s)", message); outw.format(" (%s)", message); //$NON-NLS-1$
outw.println(); outw.println();
} }

10
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java

@ -73,14 +73,14 @@ class Reflog extends TextBuiltin {
private String toString(ReflogEntry entry, int i) { private String toString(ReflogEntry entry, int i) {
final StringBuilder s = new StringBuilder(); final StringBuilder s = new StringBuilder();
s.append(entry.getNewId().abbreviate(7).name()); s.append(entry.getNewId().abbreviate(7).name());
s.append(" "); s.append(" "); //$NON-NLS-1$
s.append(ref == null ? Constants.HEAD : Repository.shortenRefName(ref)); s.append(ref == null ? Constants.HEAD : Repository.shortenRefName(ref));
s.append("@{" + i + "}:"); s.append("@{" + i + "}:"); //$NON-NLS-1$ //$NON-NLS-2$
s.append(" "); s.append(" "); //$NON-NLS-1$
// temporary workaround for bug 393463 // temporary workaround for bug 393463
if (entry.getOldId().equals(ObjectId.zeroId())) if (entry.getOldId().equals(ObjectId.zeroId()))
s.append(entry.getComment().replaceFirst("^commit:", s.append(entry.getComment().replaceFirst("^commit:", //$NON-NLS-1$
"commit (initial):")); "commit (initial):")); //$NON-NLS-1$
else else
s.append(entry.getComment()); s.append(entry.getComment());
return s.toString(); return s.toString();

22
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java

@ -154,14 +154,14 @@ class Show extends TextBuiltin {
@Option(name = "--no-prefix", usage = "usage_noPrefix") @Option(name = "--no-prefix", usage = "usage_noPrefix")
void noPrefix(@SuppressWarnings("unused") boolean on) { void noPrefix(@SuppressWarnings("unused") boolean on) {
diffFmt.setOldPrefix(""); diffFmt.setOldPrefix(""); //$NON-NLS-1$
diffFmt.setNewPrefix(""); diffFmt.setNewPrefix(""); //$NON-NLS-1$
} }
// END -- Options shared with Diff // END -- Options shared with Diff
Show() { Show() {
fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$
} }
@SuppressWarnings("boxing") @SuppressWarnings("boxing")
@ -198,7 +198,7 @@ class Show extends TextBuiltin {
break; break;
case Constants.OBJ_TREE: case Constants.OBJ_TREE:
outw.print("tree "); outw.print("tree "); //$NON-NLS-1$
outw.print(objectName); outw.print(objectName);
outw.println(); outw.println();
outw.println(); outw.println();
@ -225,7 +225,7 @@ class Show extends TextBuiltin {
private void show(RevTag tag) throws IOException { private void show(RevTag tag) throws IOException {
outw.print(CLIText.get().tagLabel); outw.print(CLIText.get().tagLabel);
outw.print(" "); outw.print(" "); //$NON-NLS-1$
outw.print(tag.getTagName()); outw.print(tag.getTagName());
outw.println(); outw.println();
@ -241,9 +241,9 @@ class Show extends TextBuiltin {
} }
outw.println(); outw.println();
final String[] lines = tag.getFullMessage().split("\n"); final String[] lines = tag.getFullMessage().split("\n"); //$NON-NLS-1$
for (final String s : lines) { for (final String s : lines) {
outw.print(" "); outw.print(" "); //$NON-NLS-1$
outw.print(s); outw.print(s);
outw.println(); outw.println();
} }
@ -261,7 +261,7 @@ class Show extends TextBuiltin {
outw.print(walk.getPathString()); outw.print(walk.getPathString());
final FileMode mode = walk.getFileMode(0); final FileMode mode = walk.getFileMode(0);
if (mode == FileMode.TREE) if (mode == FileMode.TREE)
outw.print("/"); outw.print("/"); //$NON-NLS-1$
outw.println(); outw.println();
} }
} }
@ -270,7 +270,7 @@ class Show extends TextBuiltin {
char[] outbuffer = new char[Constants.OBJECT_ID_LENGTH * 2]; char[] outbuffer = new char[Constants.OBJECT_ID_LENGTH * 2];
outw.print(CLIText.get().commitLabel); outw.print(CLIText.get().commitLabel);
outw.print(" "); outw.print(" "); //$NON-NLS-1$
c.getId().copyTo(outbuffer, outw); c.getId().copyTo(outbuffer, outw);
outw.println(); outw.println();
@ -284,9 +284,9 @@ class Show extends TextBuiltin {
fmt.format(author.getWhen()))); fmt.format(author.getWhen())));
outw.println(); outw.println();
final String[] lines = c.getFullMessage().split("\n"); final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$
for (final String s : lines) { for (final String s : lines) {
outw.print(" "); outw.print(" "); //$NON-NLS-1$
outw.print(s); outw.print(s);
outw.println(); outw.println();
} }

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

@ -60,7 +60,7 @@ class ShowRef extends TextBuiltin {
for (final Ref r : getSortedRefs()) { for (final Ref r : getSortedRefs()) {
show(r.getObjectId(), r.getName()); show(r.getObjectId(), r.getName());
if (r.getPeeledObjectId() != null) if (r.getPeeledObjectId() != null)
show(r.getPeeledObjectId(), r.getName() + "^{}"); show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
} }
} }

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

@ -99,7 +99,7 @@ class Status extends TextBuiltin {
int nbNotStagedForCommit = notStagedForCommit.size(); int nbNotStagedForCommit = notStagedForCommit.size();
if (nbNotStagedForCommit > 0) { if (nbNotStagedForCommit > 0) {
if (!firstHeader) if (!firstHeader)
printSectionHeader(""); printSectionHeader(""); //$NON-NLS-1$
printSectionHeader(CLIText.get().changesNotStagedForCommit); printSectionHeader(CLIText.get().changesNotStagedForCommit);
printList(CLIText.get().statusModified, printList(CLIText.get().statusModified,
CLIText.get().statusRemoved, null, notStagedForCommit, CLIText.get().statusRemoved, null, notStagedForCommit,
@ -109,7 +109,7 @@ class Status extends TextBuiltin {
int nbUnmerged = unmerged.size(); int nbUnmerged = unmerged.size();
if (nbUnmerged > 0) { if (nbUnmerged > 0) {
if (!firstHeader) if (!firstHeader)
printSectionHeader(""); printSectionHeader(""); //$NON-NLS-1$
printSectionHeader(CLIText.get().unmergedPaths); printSectionHeader(CLIText.get().unmergedPaths);
printList(unmerged); printList(unmerged);
firstHeader = false; firstHeader = false;
@ -117,7 +117,7 @@ class Status extends TextBuiltin {
int nbUntracked = untracked.size(); int nbUntracked = untracked.size();
if (nbUntracked > 0) { if (nbUntracked > 0) {
if (!firstHeader) if (!firstHeader)
printSectionHeader(""); printSectionHeader(""); //$NON-NLS-1$
printSectionHeader(CLIText.get().untrackedFiles); printSectionHeader(CLIText.get().untrackedFiles);
printList(untracked); printList(untracked);
} }
@ -127,8 +127,8 @@ class Status extends TextBuiltin {
throws IOException { throws IOException {
outw.println(CLIText.formatLine(MessageFormat outw.println(CLIText.formatLine(MessageFormat
.format(pattern, arguments))); .format(pattern, arguments)));
if (!pattern.equals("")) if (!pattern.equals("")) //$NON-NLS-1$
outw.println(CLIText.formatLine("")); outw.println(CLIText.formatLine("")); //$NON-NLS-1$
outw.flush(); outw.flush();
} }

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

@ -68,7 +68,7 @@ class Tag extends TextBuiltin {
private boolean force; private boolean force;
@Option(name = "-m", metaVar = "metaVar_message", usage = "usage_tagMessage") @Option(name = "-m", metaVar = "metaVar_message", usage = "usage_tagMessage")
private String message = ""; private String message = ""; //$NON-NLS-1$
@Argument(index = 0, metaVar = "metaVar_name") @Argument(index = 0, metaVar = "metaVar_name")
private String tagName; private String tagName;

7
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java

@ -134,8 +134,7 @@ public abstract class TextBuiltin {
protected void init(final Repository repository, final String gitDir) { protected void init(final Repository repository, final String gitDir) {
try { try {
final String outputEncoding = repository != null ? repository final String outputEncoding = repository != null ? repository
.getConfig() .getConfig().getString("i18n", null, "logOutputEncoding") : null; //$NON-NLS-1$ //$NON-NLS-2$
.getString("i18n", null, "logOutputEncoding") : null;
if (outs == null) if (outs == null)
outs = new FileOutputStream(FileDescriptor.out); outs = new FileOutputStream(FileDescriptor.out);
BufferedWriter bufw; BufferedWriter bufw;
@ -208,7 +207,7 @@ public abstract class TextBuiltin {
* @param clp * @param clp
*/ */
public void printUsageAndExit(final CmdLineParser clp) { public void printUsageAndExit(final CmdLineParser clp) {
printUsageAndExit("", clp); printUsageAndExit("", clp); //$NON-NLS-1$
} }
/** /**
@ -220,7 +219,7 @@ public abstract class TextBuiltin {
public void printUsageAndExit(final String message, final CmdLineParser clp) { public void printUsageAndExit(final String message, final CmdLineParser clp) {
PrintWriter writer = new PrintWriter(System.err); PrintWriter writer = new PrintWriter(System.err);
writer.println(message); writer.println(message);
writer.print("jgit "); writer.print("jgit "); //$NON-NLS-1$
writer.print(commandName); writer.print(commandName);
clp.printSingleLineUsage(writer, getResourceBundle()); clp.printSingleLineUsage(writer, getResourceBundle());
writer.println(); writer.println();

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java

@ -260,11 +260,11 @@ class DiffAlgorithms extends TextBuiltin {
"Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on"); "Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on");
outw.format("%-25s %12s ( %12s %12s )\n", // outw.format("%-25s %12s ( %12s %12s )\n", //
"", "", "N=" + minN, "N=" + maxN); "", "", "N=" + minN, "N=" + maxN);
outw.println("-----------------------------------------------------" outw.println("-----------------------------------------------------" //$NON-NLS-1$
+ "----------------"); + "----------------"); //$NON-NLS-1$
for (Test test : all) { for (Test test : all) {
outw.format("%-25s %12d ( %12d %12d )", // outw.format("%-25s %12d ( %12d %12d )", // //$NON-NLS-1$
test.algorithm.name, // test.algorithm.name, //
valueOf(test.runningTimeNanos), // valueOf(test.runningTimeNanos), //
valueOf(test.minN.runningTimeNanos), // valueOf(test.minN.runningTimeNanos), //

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java

@ -59,7 +59,7 @@ class ReadDirCache extends TextBuiltin {
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
db.readDirCache(); db.readDirCache();
final long end = System.currentTimeMillis(); final long end = System.currentTimeMillis();
outw.print(" "); outw.print(" "); //$NON-NLS-1$
outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, outw.println(MessageFormat.format(CLIText.get().averageMSPerRead,
valueOf((end - start) / cnt))); valueOf((end - start) / cnt)));
} }

12
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java

@ -95,7 +95,7 @@ import org.kohsuke.args4j.Option;
* <p> * <p>
*/ */
class RebuildCommitGraph extends TextBuiltin { class RebuildCommitGraph extends TextBuiltin {
private static final String REALLY = "--destroy-this-repository"; private static final String REALLY = "--destroy-this-repository"; //$NON-NLS-1$
@Option(name = REALLY, usage = "usage_approveDestructionOfRepository") @Option(name = REALLY, usage = "usage_approveDestructionOfRepository")
boolean really; boolean really;
@ -138,7 +138,7 @@ class RebuildCommitGraph extends TextBuiltin {
try { try {
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
final String[] parts = line.split("[ \t]{1,}"); final String[] parts = line.split("[ \t]{1,}"); //$NON-NLS-1$
final ObjectId oldId = ObjectId.fromString(parts[0]); final ObjectId oldId = ObjectId.fromString(parts[0]);
try { try {
rw.parseCommit(oldId); rw.parseCommit(oldId);
@ -165,8 +165,8 @@ class RebuildCommitGraph extends TextBuiltin {
pm.beginTask("Rewriting commits", queue.size()); pm.beginTask("Rewriting commits", queue.size());
final ObjectInserter oi = db.newObjectInserter(); final ObjectInserter oi = db.newObjectInserter();
final ObjectId emptyTree = oi.insert(Constants.OBJ_TREE, new byte[] {}); final ObjectId emptyTree = oi.insert(Constants.OBJ_TREE, new byte[] {});
final PersonIdent me = new PersonIdent("jgit rebuild-commitgraph", final PersonIdent me = new PersonIdent("jgit rebuild-commitgraph", //$NON-NLS-1$
"rebuild-commitgraph@localhost"); "rebuild-commitgraph@localhost"); //$NON-NLS-1$
while (!queue.isEmpty()) { while (!queue.isEmpty()) {
final ListIterator<ToRewrite> itr = queue final ListIterator<ToRewrite> itr = queue
.listIterator(queue.size()); .listIterator(queue.size());
@ -196,7 +196,7 @@ class RebuildCommitGraph extends TextBuiltin {
newc.setAuthor(new PersonIdent(me, new Date(t.commitTime))); newc.setAuthor(new PersonIdent(me, new Date(t.commitTime)));
newc.setCommitter(newc.getAuthor()); newc.setCommitter(newc.getAuthor());
newc.setParentIds(newParents); newc.setParentIds(newParents);
newc.setMessage("ORIGINAL " + t.oldId.name() + "\n"); newc.setMessage("ORIGINAL " + t.oldId.name() + "\n"); //$NON-NLS-2$
t.newId = oi.insert(newc); t.newId = oi.insert(newc);
rewrites.put(t.oldId, t.newId); rewrites.put(t.oldId, t.newId);
pm.update(1); pm.update(1);
@ -277,7 +277,7 @@ class RebuildCommitGraph extends TextBuiltin {
try { try {
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
final String[] parts = line.split("[ \t]{1,}"); final String[] parts = line.split("[ \t]{1,}"); //$NON-NLS-1$
final ObjectId origId = ObjectId.fromString(parts[0]); final ObjectId origId = ObjectId.fromString(parts[0]);
final String type = parts[1]; final String type = parts[1];
final String name = parts[2]; final String name = parts[2];

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java

@ -103,7 +103,7 @@ class ShowCommands extends TextBuiltin {
final ClassLoader ldr = c.getImplementationClassLoader(); final ClassLoader ldr = c.getImplementationClassLoader();
String cn = c.getImplementationClassName(); String cn = c.getImplementationClassName();
cn = cn.replace('.', '/') + ".class"; cn = cn.replace('.', '/') + ".class"; //$NON-NLS-1$
final URL url = ldr.getResource(cn); final URL url = ldr.getResource(cn);
if (url == null) { if (url == null) {

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java

@ -71,7 +71,7 @@ class ShowDirCache extends TextBuiltin {
final int stage = ent.getStage(); final int stage = ent.getStage();
outw.print(mode); outw.print(mode);
outw.format(" %6d", valueOf(len)); outw.format(" %6d", valueOf(len)); //$NON-NLS-1$
outw.print(' '); outw.print(' ');
outw.print(fmt.format(mtime)); outw.print(fmt.format(mtime));
outw.print(' '); outw.print(' ');

8
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java

@ -347,19 +347,19 @@ class TextHashFunctions extends TextBuiltin {
File parent = db.getDirectory().getParentFile(); File parent = db.getDirectory().getParentFile();
if (name.equals(Constants.DOT_GIT) && parent != null) if (name.equals(Constants.DOT_GIT) && parent != null)
name = parent.getName(); name = parent.getName();
outw.println(name + ":"); outw.println(name + ":"); //$NON-NLS-1$
} }
outw.format(" %6d files; %5d avg. unique lines/file\n", // outw.format(" %6d files; %5d avg. unique lines/file\n", //
valueOf(fileCnt), // valueOf(fileCnt), //
valueOf(lineCnt / fileCnt)); valueOf(lineCnt / fileCnt));
outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len"); outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len");
outw.println("-----------------------------------------------"); outw.println("-----------------------------------------------"); //$NON-NLS-1$
String lastHashName = null; String lastHashName = null;
for (Function fun : all) { for (Function fun : all) {
String hashName = fun.hash.name; String hashName = fun.hash.name;
if (hashName.equals(lastHashName)) if (hashName.equals(lastHashName))
hashName = ""; hashName = ""; //$NON-NLS-1$
outw.format("%-20s %-15s %9d\n", // outw.format("%-20s %-15s %9d\n", // //$NON-NLS-1$
hashName, // hashName, //
fun.fold.name, // fun.fold.name, //
valueOf(fun.maxChainLength)); valueOf(fun.maxChainLength));

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

@ -59,7 +59,7 @@ import org.kohsuke.args4j.Option;
@Command(name = "eclipse-ipzilla", common = false, usage = "usage_synchronizeIPZillaData") @Command(name = "eclipse-ipzilla", common = false, usage = "usage_synchronizeIPZillaData")
class Ipzilla extends TextBuiltin { class Ipzilla extends TextBuiltin {
@Option(name = "--url", metaVar = "metaVar_url", usage = "usage_IPZillaURL") @Option(name = "--url", metaVar = "metaVar_url", usage = "usage_IPZillaURL")
private String url = "https://dev.eclipse.org/ipzilla/"; private String url = "https://dev.eclipse.org/ipzilla/"; //$NON-NLS-1$
@Option(name = "--username", metaVar = "metaVar_user", usage = "usage_IPZillaUsername") @Option(name = "--username", metaVar = "metaVar_user", usage = "usage_IPZillaUsername")
private String username; private String username;

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java

@ -127,13 +127,13 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
final ArrayList<String> tmp = new ArrayList<String>(args.length); final ArrayList<String> tmp = new ArrayList<String>(args.length);
for (int argi = 0; argi < args.length; argi++) { for (int argi = 0; argi < args.length; argi++) {
final String str = args[argi]; final String str = args[argi];
if (str.equals("--")) { if (str.equals("--")) { //$NON-NLS-1$
while (argi < args.length) while (argi < args.length)
tmp.add(args[argi++]); tmp.add(args[argi++]);
break; break;
} }
if (str.startsWith("--")) { if (str.startsWith("--")) { //$NON-NLS-1$
final int eq = str.indexOf('='); final int eq = str.indexOf('=');
if (eq > 0) { if (eq > 0) {
tmp.add(str.substring(0, eq)); tmp.add(str.substring(0, eq));

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java

@ -88,12 +88,12 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
String name = params.getParameter(0); String name = params.getParameter(0);
boolean interesting = true; boolean interesting = true;
if (name.startsWith("^")) { if (name.startsWith("^")) { //$NON-NLS-1$
name = name.substring(1); name = name.substring(1);
interesting = false; interesting = false;
} }
final int dot2 = name.indexOf(".."); final int dot2 = name.indexOf(".."); //$NON-NLS-1$
if (dot2 != -1) { if (dot2 != -1) {
if (!option.isMultiValued()) if (!option.isMultiValued())
throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn

2
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java

@ -176,7 +176,7 @@ final class AWTPlotRenderer extends AbstractPlotRenderer<SwingLane, Color>
g.setBackground(new Color(colorComponents[0],colorComponents[1],colorComponents[2])); g.setBackground(new Color(colorComponents[0],colorComponents[1],colorComponents[2]));
} }
if (txt.length() > 12) if (txt.length() > 12)
txt = txt.substring(0,11) + "\u2026"; // ellipsis "…" (in UTF-8) txt = txt.substring(0,11) + "\u2026"; // ellipsis "…" (in UTF-8) //$NON-NLS-1$
final int texth = g.getFontMetrics().getHeight(); final int texth = g.getFontMetrics().getHeight();
int textw = g.getFontMetrics().stringWidth(txt); int textw = g.getFontMetrics().stringWidth(txt);

6
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java

@ -75,13 +75,13 @@ public class AwtAuthenticator extends CachedAuthenticator {
final StringBuilder instruction = new StringBuilder(); final StringBuilder instruction = new StringBuilder();
instruction.append(UIText.get().enterUsernameAndPasswordFor); instruction.append(UIText.get().enterUsernameAndPasswordFor);
instruction.append(" "); instruction.append(" "); //$NON-NLS-1$
if (getRequestorType() == RequestorType.PROXY) { if (getRequestorType() == RequestorType.PROXY) {
instruction.append(getRequestorType()); instruction.append(getRequestorType());
instruction.append(" "); instruction.append(" "); //$NON-NLS-1$
instruction.append(getRequestingHost()); instruction.append(getRequestingHost());
if (getRequestingPort() > 0) { if (getRequestingPort() > 0) {
instruction.append(":"); instruction.append(":"); //$NON-NLS-1$
instruction.append(getRequestingPort()); instruction.append(getRequestingPort());
} }
} else { } else {

13
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java

@ -94,7 +94,8 @@ public class CommitGraphPane extends JTable {
int h = 0; int h = 0;
for (int i = 0; i<getColumnCount(); ++i) { for (int i = 0; i<getColumnCount(); ++i) {
TableCellRenderer renderer = getDefaultRenderer(getColumnClass(i)); TableCellRenderer renderer = getDefaultRenderer(getColumnClass(i));
Component c = renderer.getTableCellRendererComponent(this, "ÅOj", false, false, 0, i); Component c = renderer.getTableCellRendererComponent(this,
"ÅOj", false, false, 0, i); //$NON-NLS-1$
h = Math.max(h, c.getPreferredSize().height); h = Math.max(h, c.getPreferredSize().height);
} }
setRowHeight(h + getRowMargin()); setRowHeight(h + getRowMargin());
@ -129,7 +130,7 @@ public class CommitGraphPane extends JTable {
final TableColumn author = cols.getColumn(1); final TableColumn author = cols.getColumn(1);
final TableColumn date = cols.getColumn(2); final TableColumn date = cols.getColumn(2);
graph.setHeaderValue(""); graph.setHeaderValue(""); //$NON-NLS-1$
author.setHeaderValue(UIText.get().author); author.setHeaderValue(UIText.get().author);
date.setHeaderValue(UIText.get().date); date.setHeaderValue(UIText.get().date);
@ -186,9 +187,9 @@ public class CommitGraphPane extends JTable {
final String valueStr; final String valueStr;
if (pi != null) if (pi != null)
valueStr = pi.getName() + " <" + pi.getEmailAddress() + ">"; valueStr = pi.getName() + " <" + pi.getEmailAddress() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
else else
valueStr = ""; valueStr = ""; //$NON-NLS-1$
return super.getTableCellRendererComponent(table, valueStr, return super.getTableCellRendererComponent(table, valueStr,
isSelected, hasFocus, row, column); isSelected, hasFocus, row, column);
} }
@ -198,7 +199,7 @@ public class CommitGraphPane extends JTable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final DateFormat fmt = new SimpleDateFormat( private final DateFormat fmt = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss"); "yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
public Component getTableCellRendererComponent(final JTable table, public Component getTableCellRendererComponent(final JTable table,
final Object value, final boolean isSelected, final Object value, final boolean isSelected,
@ -209,7 +210,7 @@ public class CommitGraphPane extends JTable {
if (pi != null) if (pi != null)
valueStr = fmt.format(pi.getWhen()); valueStr = fmt.format(pi.getWhen());
else else
valueStr = ""; valueStr = ""; //$NON-NLS-1$
return super.getTableCellRendererComponent(table, valueStr, return super.getTableCellRendererComponent(table, valueStr,
isSelected, hasFocus, row, column); isSelected, hasFocus, row, column);
} }

2
org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java

@ -130,7 +130,7 @@ public class AddCommand extends GitCommand<DirCache> {
checkCallable(); checkCallable();
DirCache dc = null; DirCache dc = null;
boolean addAll = false; boolean addAll = false;
if (filepatterns.contains(".")) if (filepatterns.contains(".")) //$NON-NLS-1$
addAll = true; addAll = true;
ObjectInserter inserter = repo.newObjectInserter(); ObjectInserter inserter = repo.newObjectInserter();

6
org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java

@ -227,14 +227,14 @@ public class ApplyCommand extends GitCommand<ApplyResult> {
} }
} }
if (!isNoNewlineAtEndOfFile(fh)) if (!isNoNewlineAtEndOfFile(fh))
newLines.add(""); newLines.add(""); //$NON-NLS-1$
if (!rt.isMissingNewlineAtEnd()) if (!rt.isMissingNewlineAtEnd())
oldLines.add(""); oldLines.add(""); //$NON-NLS-1$
if (!isChanged(oldLines, newLines)) if (!isChanged(oldLines, newLines))
return; // don't touch the file return; // don't touch the file
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
final String eol = rt.size() == 0 final String eol = rt.size() == 0
|| (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt || (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt //$NON-NLS-1$
.getLineDelimiter(); .getLineDelimiter();
for (String l : newLines) { for (String l : newLines) {
sb.append(l); sb.append(l);

6
org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java

@ -218,7 +218,7 @@ public class CheckoutCommand extends GitCommand<Ref> {
Ref headRef = repo.getRef(Constants.HEAD); Ref headRef = repo.getRef(Constants.HEAD);
String shortHeadRef = getShortBranchName(headRef); String shortHeadRef = getShortBranchName(headRef);
String refLogMessage = "checkout: moving from " + shortHeadRef; String refLogMessage = "checkout: moving from " + shortHeadRef; //$NON-NLS-1$
ObjectId branch = repo.resolve(name); ObjectId branch = repo.resolve(name);
if (branch == null) if (branch == null)
throw new RefNotFoundException(MessageFormat.format(JGitText throw new RefNotFoundException(MessageFormat.format(JGitText
@ -252,7 +252,7 @@ public class CheckoutCommand extends GitCommand<Ref> {
String toName = Repository.shortenRefName(name); String toName = Repository.shortenRefName(name);
RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null); RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null);
refUpdate.setForceUpdate(force); refUpdate.setForceUpdate(force);
refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); //$NON-NLS-1$
Result updateResult; Result updateResult;
if (ref != null) if (ref != null)
updateResult = refUpdate.link(ref.getName()); updateResult = refUpdate.link(ref.getName());
@ -469,7 +469,7 @@ public class CheckoutCommand extends GitCommand<Ref> {
&& (name == null || !Repository && (name == null || !Repository
.isValidRefName(Constants.R_HEADS + name))) .isValidRefName(Constants.R_HEADS + name)))
throw new InvalidRefNameException(MessageFormat.format(JGitText throw new InvalidRefNameException(MessageFormat.format(JGitText
.get().branchNameInvalid, name == null ? "<null>" : name)); .get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$
} }
/** /**

4
org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java

@ -148,7 +148,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
String ourName = calculateOurName(headRef); String ourName = calculateOurName(headRef);
String cherryPickName = srcCommit.getId().abbreviate(7).name() String cherryPickName = srcCommit.getId().abbreviate(7).name()
+ " " + srcCommit.getShortMessage(); + " " + srcCommit.getShortMessage(); //$NON-NLS-1$
ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE
.newMerger(repo); .newMerger(repo);
@ -168,7 +168,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
newHead = new Git(getRepository()).commit() newHead = new Git(getRepository()).commit()
.setMessage(srcCommit.getFullMessage()) .setMessage(srcCommit.getFullMessage())
.setReflogComment( .setReflogComment(
"cherry-pick: " "cherry-pick: " //$NON-NLS-1$
+ srcCommit.getShortMessage()) + srcCommit.getShortMessage())
.setAuthor(srcCommit.getAuthorIdent()).call(); .setAuthor(srcCommit.getAuthorIdent()).call();
cherryPickedRefs.add(src); cherryPickedRefs.add(src);

2
org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java

@ -131,7 +131,7 @@ public class CleanCommand extends GitCommand<Set<String>> {
if (!dryRun) if (!dryRun)
FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.delete(new File(repo.getWorkTree(), dir),
FileUtils.RECURSIVE); FileUtils.RECURSIVE);
files.add(dir + "/"); files.add(dir + "/"); //$NON-NLS-1$
} }
} catch (IOException e) { } catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e); throw new JGitInternalException(e.getMessage(), e);

3
org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

@ -158,7 +158,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
+ config.getName(); + config.getName();
RefSpec refSpec = new RefSpec(); RefSpec refSpec = new RefSpec();
refSpec = refSpec.setForceUpdate(true); refSpec = refSpec.setForceUpdate(true);
refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$ refSpec = refSpec.setSourceDestination(
Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$
config.addFetchRefSpec(refSpec); config.addFetchRefSpec(refSpec);
config.update(clonedRepo.getConfig()); config.update(clonedRepo.getConfig());

24
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

@ -159,7 +159,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
Git git = new Git(repo); Git git = new Git(repo);
try { try {
git.add() git.add()
.addFilepattern(".") .addFilepattern(".") //$NON-NLS-1$
.setUpdate(true).call(); .setUpdate(true).call();
} catch (NoFilepatternException e) { } catch (NoFilepatternException e) {
// should really not happen // should really not happen
@ -173,7 +173,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
// determine the current HEAD and the commit it is referring to // determine the current HEAD and the commit it is referring to
ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$
if (headId == null && amend) if (headId == null && amend)
throw new WrongRepositoryStateException( throw new WrongRepositoryStateException(
JGitText.get().commitAmendOnInitialNotPossible); JGitText.get().commitAmendOnInitialNotPossible);
@ -226,7 +226,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
if (reflogComment != null) { if (reflogComment != null) {
ru.setRefLogMessage(reflogComment, false); ru.setRefLogMessage(reflogComment, false);
} else { } else {
String prefix = amend ? "commit (amend): " String prefix = amend ? "commit (amend): " //$NON-NLS-1$
: "commit: "; : "commit: ";
ru.setRefLogMessage( ru.setRefLogMessage(
prefix + revCommit.getShortMessage(), false); prefix + revCommit.getShortMessage(), false);
@ -287,9 +287,9 @@ public class CommitCommand extends GitCommand<RevCommit> {
author, committer, message); author, committer, message);
message = ChangeIdUtil.insertId(message, changeId); message = ChangeIdUtil.insertId(message, changeId);
if (changeId != null) if (changeId != null)
message = message.replaceAll("\nChange-Id: I" message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$
+ ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" + ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$
+ changeId.getName() + "\n"); + changeId.getName() + "\n"); //$NON-NLS-1$
} }
private DirCache createTemporaryIndex(ObjectId headId, DirCache index) private DirCache createTemporaryIndex(ObjectId headId, DirCache index)
@ -455,7 +455,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
while (true) { while (true) {
if (p.equals(o)) if (p.equals(o))
return i; return i;
int l = p.lastIndexOf("/"); int l = p.lastIndexOf("/"); //$NON-NLS-1$
if (l < 1) if (l < 1)
break; break;
p = p.substring(0, l); p = p.substring(0, l);
@ -633,8 +633,8 @@ public class CommitCommand extends GitCommand<RevCommit> {
checkCallable(); checkCallable();
if (!only.isEmpty()) if (!only.isEmpty())
throw new JGitInternalException(MessageFormat.format( throw new JGitInternalException(MessageFormat.format(
JGitText.get().illegalCombinationOfArguments, "--all", JGitText.get().illegalCombinationOfArguments, "--all", //$NON-NLS-1$
"--only")); "--only")); //$NON-NLS-1$
this.all = all; this.all = all;
return this; return this;
} }
@ -668,9 +668,9 @@ public class CommitCommand extends GitCommand<RevCommit> {
checkCallable(); checkCallable();
if (all) if (all)
throw new JGitInternalException(MessageFormat.format( throw new JGitInternalException(MessageFormat.format(
JGitText.get().illegalCombinationOfArguments, "--only", JGitText.get().illegalCombinationOfArguments, "--only", //$NON-NLS-1$
"--all")); "--all")); //$NON-NLS-1$
String o = only.endsWith("/") ? only.substring(0, only.length() - 1) String o = only.endsWith("/") ? only.substring(0, only.length() - 1) //$NON-NLS-1$
: only; : only;
// ignore duplicates // ignore duplicates
if (!this.only.contains(o)) if (!this.only.contains(o))

26
org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java

@ -144,7 +144,7 @@ public class CreateBranchCommand extends GitCommand<Ref> {
// determine whether we are based on a commit, // determine whether we are based on a commit,
// a branch, or a tag and compose the reflog message // a branch, or a tag and compose the reflog message
String refLogMessage; String refLogMessage;
String baseBranch = ""; String baseBranch = ""; //$NON-NLS-1$
if (startPointFullName == null) { if (startPointFullName == null) {
String baseCommit; String baseCommit;
if (startCommit != null) if (startCommit != null)
@ -155,26 +155,26 @@ public class CreateBranchCommand extends GitCommand<Ref> {
baseCommit = commit.getShortMessage(); baseCommit = commit.getShortMessage();
} }
if (exists) if (exists)
refLogMessage = "branch: Reset start-point to commit " refLogMessage = "branch: Reset start-point to commit " //$NON-NLS-1$
+ baseCommit; + baseCommit;
else else
refLogMessage = "branch: Created from commit " + baseCommit; refLogMessage = "branch: Created from commit " + baseCommit; //$NON-NLS-1$
} else if (startPointFullName.startsWith(Constants.R_HEADS) } else if (startPointFullName.startsWith(Constants.R_HEADS)
|| startPointFullName.startsWith(Constants.R_REMOTES)) { || startPointFullName.startsWith(Constants.R_REMOTES)) {
baseBranch = startPointFullName; baseBranch = startPointFullName;
if (exists) if (exists)
refLogMessage = "branch: Reset start-point to branch " refLogMessage = "branch: Reset start-point to branch " //$NON-NLS-1$
+ startPointFullName; // TODO + startPointFullName; // TODO
else else
refLogMessage = "branch: Created from branch " + baseBranch; refLogMessage = "branch: Created from branch " + baseBranch; //$NON-NLS-1$
} else { } else {
startAt = revWalk.peel(revWalk.parseAny(startAt)); startAt = revWalk.peel(revWalk.parseAny(startAt));
if (exists) if (exists)
refLogMessage = "branch: Reset start-point to tag " refLogMessage = "branch: Reset start-point to tag " //$NON-NLS-1$
+ startPointFullName; + startPointFullName;
else else
refLogMessage = "branch: Created from tag " refLogMessage = "branch: Created from tag " //$NON-NLS-1$
+ startPointFullName; + startPointFullName;
} }
@ -233,9 +233,9 @@ public class CreateBranchCommand extends GitCommand<Ref> {
String autosetupflag = repo.getConfig().getString( String autosetupflag = repo.getConfig().getString(
ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_BRANCH_SECTION, null,
ConfigConstants.CONFIG_KEY_AUTOSETUPMERGE); ConfigConstants.CONFIG_KEY_AUTOSETUPMERGE);
if ("false".equals(autosetupflag)) { if ("false".equals(autosetupflag)) { //$NON-NLS-1$
doConfigure = false; doConfigure = false;
} else if ("always".equals(autosetupflag)) { } else if ("always".equals(autosetupflag)) { //$NON-NLS-1$
doConfigure = true; doConfigure = true;
} else { } else {
// in this case, the default is to configure // in this case, the default is to configure
@ -246,8 +246,8 @@ public class CreateBranchCommand extends GitCommand<Ref> {
if (doConfigure) { if (doConfigure) {
StoredConfig config = repo.getConfig(); StoredConfig config = repo.getConfig();
String[] tokens = baseBranch.split("/", 4); String[] tokens = baseBranch.split("/", 4); //$NON-NLS-1$
boolean isRemote = tokens[1].equals("remotes"); boolean isRemote = tokens[1].equals("remotes"); //$NON-NLS-1$
if (isRemote) { if (isRemote) {
// refs/remotes/<remote name>/<branch> // refs/remotes/<remote name>/<branch>
String remoteName = tokens[2]; String remoteName = tokens[2];
@ -262,7 +262,7 @@ public class CreateBranchCommand extends GitCommand<Ref> {
} else { } else {
// set "." as remote // set "." as remote
config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, config.setString(ConfigConstants.CONFIG_BRANCH_SECTION,
name, ConfigConstants.CONFIG_KEY_REMOTE, "."); name, ConfigConstants.CONFIG_KEY_REMOTE, "."); //$NON-NLS-1$
config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, config.setString(ConfigConstants.CONFIG_BRANCH_SECTION,
name, ConfigConstants.CONFIG_KEY_MERGE, baseBranch); name, ConfigConstants.CONFIG_KEY_MERGE, baseBranch);
} }
@ -298,7 +298,7 @@ public class CreateBranchCommand extends GitCommand<Ref> {
if (name == null if (name == null
|| !Repository.isValidRefName(Constants.R_HEADS + name)) || !Repository.isValidRefName(Constants.R_HEADS + name))
throw new InvalidRefNameException(MessageFormat.format(JGitText throw new InvalidRefNameException(MessageFormat.format(JGitText
.get().branchNameInvalid, name == null ? "<null>" : name)); .get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$
} }
/** /**

2
org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java

@ -138,7 +138,7 @@ public class DeleteBranchCommand extends GitCommand<List<String>> {
JGitText.get().cannotDeleteCheckedOutBranch, JGitText.get().cannotDeleteCheckedOutBranch,
branchName)); branchName));
RefUpdate update = repo.updateRef(fullName); RefUpdate update = repo.updateRef(fullName);
update.setRefLogMessage("branch deleted", false); update.setRefLogMessage("branch deleted", false); //$NON-NLS-1$
update.setForceUpdate(true); update.setForceUpdate(true);
Result deleteResult = update.delete(); Result deleteResult = update.delete();

2
org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java

@ -120,7 +120,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
try { try {
if (cached) { if (cached) {
if (oldTree == null) { if (oldTree == null) {
ObjectId head = repo.resolve(HEAD + "^{tree}"); ObjectId head = repo.resolve(HEAD + "^{tree}"); //$NON-NLS-1$
if (head == null) if (head == null)
throw new NoHeadException(JGitText.get().cannotReadTree); throw new NoHeadException(JGitText.get().cannotReadTree);
CanonicalTreeParser p = new CanonicalTreeParser(); CanonicalTreeParser p = new CanonicalTreeParser();

2
org.eclipse.jgit/src/org/eclipse/jgit/api/InitCommand.java

@ -80,7 +80,7 @@ public class InitCommand implements Callable<Git> {
d = new File(d, Constants.DOT_GIT); d = new File(d, Constants.DOT_GIT);
builder.setGitDir(d); builder.setGitDir(d);
} else if (builder.getGitDir() == null) { } else if (builder.getGitDir() == null) {
File d = new File("."); File d = new File("."); //$NON-NLS-1$
if (d.getParentFile() != null) if (d.getParentFile() != null)
d = d.getParentFile(); d = d.getParentFile();
if (!bare) if (!bare)

4
org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java

@ -161,9 +161,9 @@ public class LsRemoteCommand extends
Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1); Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1);
if (tags) if (tags)
refSpecs.add(new RefSpec( refSpecs.add(new RefSpec(
"refs/tags/*:refs/remotes/origin/tags/*")); "refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$
if (heads) if (heads)
refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); //$NON-NLS-1$
Collection<Ref> refs; Collection<Ref> refs;
Map<String, Ref> refmap = new HashMap<String, Ref>(); Map<String, Ref> refmap = new HashMap<String, Ref>();
fc = transport.openFetch(); fc = transport.openFetch();

14
org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java

@ -151,7 +151,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
if (head == null) if (head == null)
throw new NoHeadException( throw new NoHeadException(
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
StringBuilder refLogMessage = new StringBuilder("merge "); StringBuilder refLogMessage = new StringBuilder("merge "); //$NON-NLS-1$
// Check for FAST_FORWARD, ALREADY_UP_TO_DATE // Check for FAST_FORWARD, ALREADY_UP_TO_DATE
revWalk = new RevWalk(repo); revWalk = new RevWalk(repo);
@ -179,7 +179,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
.updateRef(head.getTarget().getName()); .updateRef(head.getTarget().getName());
refUpdate.setNewObjectId(objectId); refUpdate.setNewObjectId(objectId);
refUpdate.setExpectedOldObjectId(null); refUpdate.setExpectedOldObjectId(null);
refUpdate.setRefLogMessage("initial pull", false); refUpdate.setRefLogMessage("initial pull", false); //$NON-NLS-1$
if (refUpdate.update() != Result.NEW) if (refUpdate.update() != Result.NEW)
throw new NoHeadException( throw new NoHeadException(
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
@ -200,7 +200,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
&& fastForwardMode == FastForwardMode.FF) { && fastForwardMode == FastForwardMode.FF) {
// FAST_FORWARD detected: skip doing a real merge but only // FAST_FORWARD detected: skip doing a real merge but only
// update HEAD // update HEAD
refLogMessage.append(": " + MergeStatus.FAST_FORWARD); refLogMessage.append(": " + MergeStatus.FAST_FORWARD); //$NON-NLS-1$
dco = new DirCacheCheckout(repo, dco = new DirCacheCheckout(repo,
headCommit.getTree(), repo.lockDirCache(), headCommit.getTree(), repo.lockDirCache(),
srcCommit.getTree()); srcCommit.getTree());
@ -233,7 +233,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
new ObjectId[] { headCommit, srcCommit }, new ObjectId[] { headCommit, srcCommit },
MergeStatus.ABORTED, mergeStrategy, null, null); MergeStatus.ABORTED, mergeStrategy, null, null);
} }
String mergeMessage = ""; String mergeMessage = ""; //$NON-NLS-1$
if (!squash) { if (!squash) {
mergeMessage = new MergeMessageFormatter().format( mergeMessage = new MergeMessageFormatter().format(
commits, head); commits, head);
@ -254,7 +254,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
if (merger instanceof ResolveMerger) { if (merger instanceof ResolveMerger) {
ResolveMerger resolveMerger = (ResolveMerger) merger; ResolveMerger resolveMerger = (ResolveMerger) merger;
resolveMerger.setCommitNames(new String[] { resolveMerger.setCommitNames(new String[] {
"BASE", "HEAD", ref.getName() }); "BASE", "HEAD", ref.getName() }); //$NON-NLS-1$
resolveMerger.setWorkingTreeIterator(new FileTreeIterator(repo)); resolveMerger.setWorkingTreeIterator(new FileTreeIterator(repo));
noProblems = merger.merge(headCommit, srcCommit); noProblems = merger.merge(headCommit, srcCommit);
lowLevelResults = resolveMerger lowLevelResults = resolveMerger
@ -263,11 +263,11 @@ public class MergeCommand extends GitCommand<MergeResult> {
unmergedPaths = resolveMerger.getUnmergedPaths(); unmergedPaths = resolveMerger.getUnmergedPaths();
} else } else
noProblems = merger.merge(headCommit, srcCommit); noProblems = merger.merge(headCommit, srcCommit);
refLogMessage.append(": Merge made by "); refLogMessage.append(": Merge made by "); //$NON-NLS-1$
if (!revWalk.isMergedInto(headCommit, srcCommit)) if (!revWalk.isMergedInto(headCommit, srcCommit))
refLogMessage.append(mergeStrategy.getName()); refLogMessage.append(mergeStrategy.getName());
else else
refLogMessage.append("recursive"); refLogMessage.append("recursive"); //$NON-NLS-1$
refLogMessage.append('.'); refLogMessage.append('.');
if (noProblems) { if (noProblems) {
dco = new DirCacheCheckout(repo, dco = new DirCacheCheckout(repo,

1
org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java

@ -324,6 +324,7 @@ public class MergeResult {
return base; return base;
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
boolean first = true; boolean first = true;

4
org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java

@ -76,7 +76,7 @@ import org.eclipse.jgit.transport.FetchResult;
*/ */
public class PullCommand extends TransportCommand<PullCommand, PullResult> { public class PullCommand extends TransportCommand<PullCommand, PullResult> {
private final static String DOT = "."; private final static String DOT = "."; //$NON-NLS-1$
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
@ -218,7 +218,7 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
JGitText.get().missingConfigurationForKey, missingKey)); JGitText.get().missingConfigurationForKey, missingKey));
} }
final boolean isRemote = !remote.equals("."); final boolean isRemote = !remote.equals("."); //$NON-NLS-1$
String remoteUri; String remoteUri;
FetchResult fetchRes; FetchResult fetchRes;
if (isRemote) { if (isRemote) {

1
org.eclipse.jgit/src/org/eclipse/jgit/api/PullResult.java

@ -112,6 +112,7 @@ public class PullResult {
return true; return true;
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

80
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

@ -110,40 +110,40 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
/** /**
* The name of the "rebase-merge" folder * The name of the "rebase-merge" folder
*/ */
public static final String REBASE_MERGE = "rebase-merge"; public static final String REBASE_MERGE = "rebase-merge"; //$NON-NLS-1$
/** /**
* The name of the "stopped-sha" file * The name of the "stopped-sha" file
*/ */
public static final String STOPPED_SHA = "stopped-sha"; public static final String STOPPED_SHA = "stopped-sha"; //$NON-NLS-1$
private static final String AUTHOR_SCRIPT = "author-script"; private static final String AUTHOR_SCRIPT = "author-script"; //$NON-NLS-1$
private static final String DONE = "done"; private static final String DONE = "done"; //$NON-NLS-1$
private static final String GIT_AUTHOR_DATE = "GIT_AUTHOR_DATE"; private static final String GIT_AUTHOR_DATE = "GIT_AUTHOR_DATE"; //$NON-NLS-1$
private static final String GIT_AUTHOR_EMAIL = "GIT_AUTHOR_EMAIL"; private static final String GIT_AUTHOR_EMAIL = "GIT_AUTHOR_EMAIL"; //$NON-NLS-1$
private static final String GIT_AUTHOR_NAME = "GIT_AUTHOR_NAME"; private static final String GIT_AUTHOR_NAME = "GIT_AUTHOR_NAME"; //$NON-NLS-1$
private static final String GIT_REBASE_TODO = "git-rebase-todo"; private static final String GIT_REBASE_TODO = "git-rebase-todo"; //$NON-NLS-1$
private static final String HEAD_NAME = "head-name"; private static final String HEAD_NAME = "head-name"; //$NON-NLS-1$
private static final String INTERACTIVE = "interactive"; private static final String INTERACTIVE = "interactive"; //$NON-NLS-1$
private static final String MESSAGE = "message"; private static final String MESSAGE = "message"; //$NON-NLS-1$
private static final String ONTO = "onto"; private static final String ONTO = "onto"; //$NON-NLS-1$
private static final String ONTO_NAME = "onto-name"; private static final String ONTO_NAME = "onto-name"; //$NON-NLS-1$
private static final String PATCH = "patch"; private static final String PATCH = "patch"; //$NON-NLS-1$
private static final String REBASE_HEAD = "head"; private static final String REBASE_HEAD = "head"; //$NON-NLS-1$
private static final String AMEND = "amend"; private static final String AMEND = "amend"; //$NON-NLS-1$
/** /**
* The available operations * The available operations
@ -275,9 +275,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
for (Step step : steps) { for (Step step : steps) {
sb.setLength(0); sb.setLength(0);
sb.append(step.action.token); sb.append(step.action.token);
sb.append(" "); sb.append(" "); //$NON-NLS-1$
sb.append(step.commit.name()); sb.append(step.commit.name());
sb.append(" "); sb.append(" "); //$NON-NLS-1$
sb.append(RawParseUtils.decode(step.shortMessage) sb.append(RawParseUtils.decode(step.shortMessage)
.trim()); .trim());
fw.write(sb.toString()); fw.write(sb.toString());
@ -398,7 +398,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
} }
private RevCommit checkoutCurrentHead() throws IOException, NoHeadException { private RevCommit checkoutCurrentHead() throws IOException, NoHeadException {
ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); ObjectId headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$
if (headTree == null) if (headTree == null)
throw new NoHeadException( throw new NoHeadException(
JGitText.get().cannotRebaseWithoutCurrentHead); JGitText.get().cannotRebaseWithoutCurrentHead);
@ -442,7 +442,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
treeWalk.reset(); treeWalk.reset();
treeWalk.setRecursive(true); treeWalk.setRecursive(true);
treeWalk.addTree(new DirCacheIterator(dc)); treeWalk.addTree(new DirCacheIterator(dc));
ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); ObjectId id = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$
if (id == null) if (id == null)
throw new NoHeadException( throw new NoHeadException(
JGitText.get().cannotRebaseWithoutCurrentHead); JGitText.get().cannotRebaseWithoutCurrentHead);
@ -496,23 +496,23 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
String toAuthorScript(PersonIdent author) { String toAuthorScript(PersonIdent author) {
StringBuilder sb = new StringBuilder(100); StringBuilder sb = new StringBuilder(100);
sb.append(GIT_AUTHOR_NAME); sb.append(GIT_AUTHOR_NAME);
sb.append("='"); sb.append("='"); //$NON-NLS-1$
sb.append(author.getName()); sb.append(author.getName());
sb.append("'\n"); sb.append("'\n"); //$NON-NLS-1$
sb.append(GIT_AUTHOR_EMAIL); sb.append(GIT_AUTHOR_EMAIL);
sb.append("='"); sb.append("='"); //$NON-NLS-1$
sb.append(author.getEmailAddress()); sb.append(author.getEmailAddress());
sb.append("'\n"); sb.append("'\n"); //$NON-NLS-1$
// the command line uses the "external String" // the command line uses the "external String"
// representation for date and timezone // representation for date and timezone
sb.append(GIT_AUTHOR_DATE); sb.append(GIT_AUTHOR_DATE);
sb.append("='"); sb.append("='"); //$NON-NLS-1$
sb.append("@"); // @ for time in seconds since 1970 sb.append("@"); // @ for time in seconds since 1970 //$NON-NLS-1$
String externalString = author.toExternalString(); String externalString = author.toExternalString();
sb sb
.append(externalString.substring(externalString .append(externalString.substring(externalString
.lastIndexOf('>') + 2)); .lastIndexOf('>') + 2));
sb.append("'\n"); sb.append("'\n"); //$NON-NLS-1$
return sb.toString(); return sb.toString();
} }
@ -655,7 +655,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
createFile(rebaseDir, HEAD_NAME, headName); createFile(rebaseDir, HEAD_NAME, headName);
createFile(rebaseDir, ONTO, upstreamCommit.name()); createFile(rebaseDir, ONTO, upstreamCommit.name());
createFile(rebaseDir, ONTO_NAME, upstreamCommitName); createFile(rebaseDir, ONTO_NAME, upstreamCommitName);
createFile(rebaseDir, INTERACTIVE, ""); createFile(rebaseDir, INTERACTIVE, ""); //$NON-NLS-1$
BufferedWriter fw = new BufferedWriter(new OutputStreamWriter( BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(new File(rebaseDir, GIT_REBASE_TODO)), new FileOutputStream(new File(rebaseDir, GIT_REBASE_TODO)),
Constants.CHARACTER_ENCODING)); Constants.CHARACTER_ENCODING));
@ -668,9 +668,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
for (RevCommit commit : cherryPickList) { for (RevCommit commit : cherryPickList) {
sb.setLength(0); sb.setLength(0);
sb.append(Action.PICK.toToken()); sb.append(Action.PICK.toToken());
sb.append(" "); sb.append(" "); //$NON-NLS-1$
sb.append(reader.abbreviate(commit).name()); sb.append(reader.abbreviate(commit).name());
sb.append(" "); sb.append(" "); //$NON-NLS-1$
sb.append(commit.getShortMessage()); sb.append(commit.getShortMessage());
fw.write(sb.toString()); fw.write(sb.toString());
fw.newLine(); fw.newLine();
@ -747,8 +747,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
RefUpdate rup = repo.updateRef(headName); RefUpdate rup = repo.updateRef(headName);
rup.setExpectedOldObjectId(oldCommit); rup.setExpectedOldObjectId(oldCommit);
rup.setNewObjectId(newCommit); rup.setNewObjectId(newCommit);
rup.setRefLogMessage("Fast-foward from " + oldCommit.name() rup.setRefLogMessage("Fast-foward from " + oldCommit.name() //$NON-NLS-1$
+ " to " + newCommit.name(), false); + " to " + newCommit.name(), false); //$NON-NLS-1$
Result res = rup.update(walk); Result res = rup.update(walk);
switch (res) { switch (res) {
case FAST_FORWARD: case FAST_FORWARD:
@ -756,7 +756,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
case FORCED: case FORCED:
break; break;
default: default:
throw new IOException("Could not fast-forward"); throw new IOException("Could not fast-forward"); //$NON-NLS-1$
} }
} }
return newCommit; return newCommit;
@ -1082,11 +1082,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
*/ */
public static enum Action { public static enum Action {
/** Use commit */ /** Use commit */
PICK("pick", "p"), PICK("pick", "p"), //$NON-NLS-1$ //$NON-NLS-2$
/** Use commit, but edit the commit message */ /** Use commit, but edit the commit message */
REWORD("reword", "r"), REWORD("reword", "r"), //$NON-NLS-1$ //$NON-NLS-2$
/** Use commit, but stop for amending */ /** Use commit, but stop for amending */
EDIT("edit", "e"); // later add SQUASH, FIXUP, etc. EDIT("edit", "e"); // later add SQUASH, FIXUP, etc. //$NON-NLS-1$ //$NON-NLS-2$
private final String token; private final String token;
@ -1104,6 +1104,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
return this.token; return this.token;
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
return "Action[" + token + "]"; return "Action[" + token + "]";
@ -1165,9 +1166,12 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
return shortMessage; return shortMessage;
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
return "Step[" + action + ", " return "Step["
+ action
+ ", "
+ ((commit == null) ? "null" : commit) + ((commit == null) ? "null" : commit)
+ ", " + ", "
+ ((shortMessage == null) ? "null" : new String( + ((shortMessage == null) ? "null" : new String(
@ -1199,7 +1203,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
// the time is saved as <seconds since 1970> <timezone offset> // the time is saved as <seconds since 1970> <timezone offset>
int timeStart = 0; int timeStart = 0;
if (time.startsWith("@")) if (time.startsWith("@")) //$NON-NLS-1$
timeStart = 1; timeStart = 1;
else else
timeStart = 0; timeStart = 0;

2
org.eclipse.jgit/src/org/eclipse/jgit/api/RenameBranchCommand.java

@ -101,7 +101,7 @@ public class RenameBranchCommand extends GitCommand<Ref> {
if (newName == null) if (newName == null)
throw new InvalidRefNameException(MessageFormat.format(JGitText throw new InvalidRefNameException(MessageFormat.format(JGitText
.get().branchNameInvalid, "<null>")); .get().branchNameInvalid, "<null>")); //$NON-NLS-1$
try { try {
String fullOldName; String fullOldName;

6
org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java

@ -153,7 +153,7 @@ public class ResetCommand extends GitCommand<Ref> {
// resolve the ref to a commit // resolve the ref to a commit
final ObjectId commitId; final ObjectId commitId;
try { try {
commitId = repo.resolve(ref + "^{commit}"); commitId = repo.resolve(ref + "^{commit}"); //$NON-NLS-1$
if (commitId == null) { if (commitId == null) {
// @TODO throw an InvalidRefNameException. We can't do that // @TODO throw an InvalidRefNameException. We can't do that
// now because this would break the API // now because this would break the API
@ -253,7 +253,7 @@ public class ResetCommand extends GitCommand<Ref> {
if (!filepaths.isEmpty()) if (!filepaths.isEmpty())
throw new JGitInternalException(MessageFormat.format( throw new JGitInternalException(MessageFormat.format(
JGitText.get().illegalCombinationOfArguments, JGitText.get().illegalCombinationOfArguments,
"[--mixed | --soft | --hard]", "<paths>...")); "[--mixed | --soft | --hard]", "<paths>...")); //$NON-NLS-1$
this.mode = mode; this.mode = mode;
return this; return this;
} }
@ -267,7 +267,7 @@ public class ResetCommand extends GitCommand<Ref> {
if (mode != null) if (mode != null)
throw new JGitInternalException(MessageFormat.format( throw new JGitInternalException(MessageFormat.format(
JGitText.get().illegalCombinationOfArguments, "<paths>...", JGitText.get().illegalCombinationOfArguments, "<paths>...",
"[--mixed | --soft | --hard]")); "[--mixed | --soft | --hard]")); //$NON-NLS-1$
filepaths.add(file); filepaths.add(file);
return this; return this;
} }

10
org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java

@ -164,13 +164,13 @@ public class RevertCommand extends GitCommand<RevCommit> {
merger.getResultTreeId()); merger.getResultTreeId());
dco.setFailOnConflict(true); dco.setFailOnConflict(true);
dco.checkout(); dco.checkout();
String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; //$NON-NLS-2$
String newMessage = shortMessage + "\n\n" String newMessage = shortMessage + "\n\n" //$NON-NLS-1$
+ "This reverts commit " + "This reverts commit " //$NON-NLS-1$
+ srcCommit.getId().getName() + ".\n"; + srcCommit.getId().getName() + ".\n"; //$NON-NLS-1$
newHead = new Git(getRepository()).commit() newHead = new Git(getRepository()).commit()
.setMessage(newMessage) .setMessage(newMessage)
.setReflogComment("revert: " + shortMessage).call(); .setReflogComment("revert: " + shortMessage).call(); //$NON-NLS-1$
revertedRefs.add(src); revertedRefs.add(src);
} else { } else {
unmergedPaths = merger.getUnmergedPaths(); unmergedPaths = merger.getUnmergedPaths();

6
org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java

@ -84,7 +84,7 @@ import org.eclipse.jgit.util.FileUtils;
*/ */
public class StashApplyCommand extends GitCommand<ObjectId> { public class StashApplyCommand extends GitCommand<ObjectId> {
private static final String DEFAULT_REF = Constants.STASH + "@{0}"; private static final String DEFAULT_REF = Constants.STASH + "@{0}"; //$NON-NLS-1$
/** /**
* Stash diff filter that looks for differences in the first three trees * Stash diff filter that looks for differences in the first three trees
@ -115,7 +115,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
@Override @Override
public String toString() { public String toString() {
return "STASH_DIFF"; return "STASH_DIFF"; //$NON-NLS-1$
} }
} }
@ -192,7 +192,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
private ObjectId getHeadTree() throws GitAPIException { private ObjectId getHeadTree() throws GitAPIException {
final ObjectId headTree; final ObjectId headTree;
try { try {
headTree = repo.resolve(Constants.HEAD + "^{tree}"); headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$
} catch (IOException e) { } catch (IOException e) {
throw new JGitInternalException(JGitText.get().cannotReadTree, e); throw new JGitInternalException(JGitText.get().cannotReadTree, e);
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java

@ -120,7 +120,7 @@ public class TagCommand extends GitCommand<Ref> {
// if no id is set, we should attempt to use HEAD // if no id is set, we should attempt to use HEAD
if (id == null) { if (id == null) {
ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$
if (objectId == null) if (objectId == null)
throw new NoHeadException( throw new NoHeadException(
JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported);
@ -142,7 +142,7 @@ public class TagCommand extends GitCommand<Ref> {
RefUpdate tagRef = repo.updateRef(refName); RefUpdate tagRef = repo.updateRef(refName);
tagRef.setNewObjectId(tagId); tagRef.setNewObjectId(tagId);
tagRef.setForceUpdate(forceUpdate); tagRef.setForceUpdate(forceUpdate);
tagRef.setRefLogMessage("tagged " + name, false); tagRef.setRefLogMessage("tagged " + name, false); //$NON-NLS-1$
Result updateResult = tagRef.update(revWalk); Result updateResult = tagRef.update(revWalk);
switch (updateResult) { switch (updateResult) {
case NEW: case NEW:

4
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ConcurrentRefUpdateException.java

@ -62,7 +62,7 @@ public class ConcurrentRefUpdateException extends GitAPIException {
*/ */
public ConcurrentRefUpdateException(String message, Ref ref, public ConcurrentRefUpdateException(String message, Ref ref,
RefUpdate.Result rc, Throwable cause) { RefUpdate.Result rc, Throwable cause) {
super((rc == null) ? message : message + ". " super((rc == null) ? message : message + ". " //$NON-NLS-1$
+ MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc), cause); + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc), cause);
this.rc = rc; this.rc = rc;
this.ref = ref; this.ref = ref;
@ -75,7 +75,7 @@ public class ConcurrentRefUpdateException extends GitAPIException {
*/ */
public ConcurrentRefUpdateException(String message, Ref ref, public ConcurrentRefUpdateException(String message, Ref ref,
RefUpdate.Result rc) { RefUpdate.Result rc) {
super((rc == null) ? message : message + ". " super((rc == null) ? message : message + ". " //$NON-NLS-1$
+ MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc)); + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc));
this.rc = rc; this.rc = rc;
this.ref = ref; this.ref = ref;

2
org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameGenerator.java

@ -177,7 +177,7 @@ public class BlameGenerator {
revPool = new RevWalk(getRepository()); revPool = new RevWalk(getRepository());
revPool.setRetainBody(true); revPool.setRetainBody(true);
SEEN = revPool.newFlag("SEEN"); SEEN = revPool.newFlag("SEEN"); //$NON-NLS-1$
reader = revPool.getObjectReader(); reader = revPool.getObjectReader();
treeWalk = new TreeWalk(reader); treeWalk = new TreeWalk(reader);
treeWalk.setRecursive(true); treeWalk.setRecursive(true);

2
org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java

@ -321,7 +321,7 @@ public class BlameResult {
@Override @Override
public String toString() { public String toString() {
StringBuilder r = new StringBuilder(); StringBuilder r = new StringBuilder();
r.append("BlameResult: "); r.append("BlameResult: "); //$NON-NLS-1$
r.append(getResultPath()); r.append(getResultPath());
return r.toString(); return r.toString();
} }

5
org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java

@ -275,6 +275,7 @@ class Candidate {
return r; return r;
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
StringBuilder r = new StringBuilder(); StringBuilder r = new StringBuilder();
@ -324,7 +325,7 @@ class Candidate {
@Override @Override
public String toString() { public String toString() {
return "Reverse" + super.toString(); return "Reverse" + super.toString(); //$NON-NLS-1$
} }
} }
@ -380,7 +381,7 @@ class Candidate {
@Override @Override
PersonIdent getAuthor() { PersonIdent getAuthor() {
return new PersonIdent(description, ""); return new PersonIdent(description, ""); //$NON-NLS-1$
} }
} }
} }

16
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java

@ -78,10 +78,10 @@ public class DiffConfig {
private final int renameLimit; private final int renameLimit;
private DiffConfig(final Config rc) { private DiffConfig(final Config rc) {
noPrefix = rc.getBoolean("diff", "noprefix", false); noPrefix = rc.getBoolean("diff", "noprefix", false); //$NON-NLS-1$ //$NON-NLS-2$
renameDetectionType = parseRenameDetectionType(rc.getString("diff", renameDetectionType = parseRenameDetectionType(rc.getString("diff", //$NON-NLS-1$
null, "renames")); null, "renames")); //$NON-NLS-1$
renameLimit = rc.getInt("diff", "renamelimit", 200); renameLimit = rc.getInt("diff", "renamelimit", 200); //$NON-NLS-1$ //$NON-NLS-2$
} }
/** @return true if the prefix "a/" and "b/" should be suppressed. */ /** @return true if the prefix "a/" and "b/" should be suppressed. */
@ -108,16 +108,16 @@ public class DiffConfig {
final String renameString) { final String renameString) {
if (renameString == null) if (renameString == null)
return RenameDetectionType.FALSE; return RenameDetectionType.FALSE;
else if (StringUtils.equalsIgnoreCase("copy", renameString) else if (StringUtils.equalsIgnoreCase("copy", renameString) //$NON-NLS-1$
|| StringUtils.equalsIgnoreCase("copies", renameString)) || StringUtils.equalsIgnoreCase("copies", renameString)) //$NON-NLS-1$
return RenameDetectionType.COPY; return RenameDetectionType.COPY;
else { else {
final Boolean renameBoolean = StringUtils final Boolean renameBoolean = StringUtils
.toBooleanOrNull(renameString); .toBooleanOrNull(renameString);
if (renameBoolean == null) if (renameBoolean == null)
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
JGitText.get().enumValueNotSupported2, "diff", JGitText.get().enumValueNotSupported2, "diff", //$NON-NLS-1$
"renames", renameString)); "renames", renameString)); //$NON-NLS-1$
else if (renameBoolean.booleanValue()) else if (renameBoolean.booleanValue())
return RenameDetectionType.TRUE; return RenameDetectionType.TRUE;
else else

3
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java

@ -63,7 +63,7 @@ public class DiffEntry {
.fromObjectId(ObjectId.zeroId()); .fromObjectId(ObjectId.zeroId());
/** Magical file name used for file adds or deletes. */ /** Magical file name used for file adds or deletes. */
public static final String DEV_NULL = "/dev/null"; public static final String DEV_NULL = "/dev/null"; //$NON-NLS-1$
/** General type of change a single file-level patch describes. */ /** General type of change a single file-level patch describes. */
public static enum ChangeType { public static enum ChangeType {
@ -407,6 +407,7 @@ public class DiffEntry {
return side == Side.OLD ? getOldId() : getNewId(); return side == Side.OLD ? getOldId() : getNewId();
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();

56
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java

@ -105,7 +105,7 @@ import org.eclipse.jgit.util.io.DisabledOutputStream;
public class DiffFormatter { public class DiffFormatter {
private static final int DEFAULT_BINARY_FILE_THRESHOLD = PackConfig.DEFAULT_BIG_FILE_THRESHOLD; private static final int DEFAULT_BINARY_FILE_THRESHOLD = PackConfig.DEFAULT_BIG_FILE_THRESHOLD;
private static final byte[] noNewLine = encodeASCII("\\ No newline at end of file\n"); private static final byte[] noNewLine = encodeASCII("\\ No newline at end of file\n"); //$NON-NLS-1$
/** Magic return content indicating it is empty or no content present. */ /** Magic return content indicating it is empty or no content present. */
private static final byte[] EMPTY = new byte[] {}; private static final byte[] EMPTY = new byte[] {};
@ -129,9 +129,9 @@ public class DiffFormatter {
private int binaryFileThreshold = DEFAULT_BINARY_FILE_THRESHOLD; private int binaryFileThreshold = DEFAULT_BINARY_FILE_THRESHOLD;
private String oldPrefix = "a/"; private String oldPrefix = "a/"; //$NON-NLS-1$
private String newPrefix = "b/"; private String newPrefix = "b/"; //$NON-NLS-1$
private TreeFilter pathFilter = TreeFilter.ALL; private TreeFilter pathFilter = TreeFilter.ALL;
@ -179,8 +179,8 @@ public class DiffFormatter {
DiffConfig dc = db.getConfig().get(DiffConfig.KEY); DiffConfig dc = db.getConfig().get(DiffConfig.KEY);
if (dc.isNoPrefix()) { if (dc.isNoPrefix()) {
setOldPrefix(""); setOldPrefix(""); //$NON-NLS-1$
setNewPrefix(""); setNewPrefix(""); //$NON-NLS-1$
} }
setDetectRenames(dc.isRenameDetectionEnabled()); setDetectRenames(dc.isRenameDetectionEnabled());
@ -633,12 +633,12 @@ public class DiffFormatter {
private void writeGitLinkDiffText(OutputStream o, DiffEntry ent) private void writeGitLinkDiffText(OutputStream o, DiffEntry ent)
throws IOException { throws IOException {
if (ent.getOldMode() == GITLINK) { if (ent.getOldMode() == GITLINK) {
o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() //$NON-NLS-1$
+ "\n")); + "\n")); //$NON-NLS-1$
} }
if (ent.getNewMode() == GITLINK) { if (ent.getNewMode() == GITLINK) {
o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() //$NON-NLS-1$
+ "\n")); + "\n")); //$NON-NLS-1$
} }
} }
@ -918,7 +918,7 @@ public class DiffFormatter {
if (aRaw == BINARY || bRaw == BINARY // if (aRaw == BINARY || bRaw == BINARY //
|| RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { || RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) {
formatOldNewPaths(buf, ent); formatOldNewPaths(buf, ent);
buf.write(encodeASCII("Binary files differ\n")); buf.write(encodeASCII("Binary files differ\n")); //$NON-NLS-1$
editList = new EditList(); editList = new EditList();
type = PatchType.BINARY; type = PatchType.BINARY;
@ -1016,7 +1016,7 @@ public class DiffFormatter {
final FileMode oldMode = ent.getOldMode(); final FileMode oldMode = ent.getOldMode();
final FileMode newMode = ent.getNewMode(); final FileMode newMode = ent.getNewMode();
o.write(encodeASCII("diff --git ")); o.write(encodeASCII("diff --git ")); //$NON-NLS-1$
o.write(encode(quotePath(oldPrefix + (type == ADD ? newp : oldp)))); o.write(encode(quotePath(oldPrefix + (type == ADD ? newp : oldp))));
o.write(' '); o.write(' ');
o.write(encode(quotePath(newPrefix + (type == DELETE ? oldp : newp)))); o.write(encode(quotePath(newPrefix + (type == DELETE ? oldp : newp))));
@ -1024,40 +1024,40 @@ public class DiffFormatter {
switch (type) { switch (type) {
case ADD: case ADD:
o.write(encodeASCII("new file mode ")); o.write(encodeASCII("new file mode ")); //$NON-NLS-1$
newMode.copyTo(o); newMode.copyTo(o);
o.write('\n'); o.write('\n');
break; break;
case DELETE: case DELETE:
o.write(encodeASCII("deleted file mode ")); o.write(encodeASCII("deleted file mode ")); //$NON-NLS-1$
oldMode.copyTo(o); oldMode.copyTo(o);
o.write('\n'); o.write('\n');
break; break;
case RENAME: case RENAME:
o.write(encodeASCII("similarity index " + ent.getScore() + "%")); o.write(encodeASCII("similarity index " + ent.getScore() + "%")); //$NON-NLS-1$ //$NON-NLS-2$
o.write('\n'); o.write('\n');
o.write(encode("rename from " + quotePath(oldp))); o.write(encode("rename from " + quotePath(oldp))); //$NON-NLS-1$
o.write('\n'); o.write('\n');
o.write(encode("rename to " + quotePath(newp))); o.write(encode("rename to " + quotePath(newp))); //$NON-NLS-1$
o.write('\n'); o.write('\n');
break; break;
case COPY: case COPY:
o.write(encodeASCII("similarity index " + ent.getScore() + "%")); o.write(encodeASCII("similarity index " + ent.getScore() + "%")); //$NON-NLS-1$ //$NON-NLS-2$
o.write('\n'); o.write('\n');
o.write(encode("copy from " + quotePath(oldp))); o.write(encode("copy from " + quotePath(oldp))); //$NON-NLS-1$
o.write('\n'); o.write('\n');
o.write(encode("copy to " + quotePath(newp))); o.write(encode("copy to " + quotePath(newp))); //$NON-NLS-1$
o.write('\n'); o.write('\n');
if (!oldMode.equals(newMode)) { if (!oldMode.equals(newMode)) {
o.write(encodeASCII("new file mode ")); o.write(encodeASCII("new file mode ")); //$NON-NLS-1$
newMode.copyTo(o); newMode.copyTo(o);
o.write('\n'); o.write('\n');
} }
@ -1065,19 +1065,19 @@ public class DiffFormatter {
case MODIFY: case MODIFY:
if (0 < ent.getScore()) { if (0 < ent.getScore()) {
o.write(encodeASCII("dissimilarity index " o.write(encodeASCII("dissimilarity index " //$NON-NLS-1$
+ (100 - ent.getScore()) + "%")); + (100 - ent.getScore()) + "%")); //$NON-NLS-1$
o.write('\n'); o.write('\n');
} }
break; break;
} }
if ((type == MODIFY || type == RENAME) && !oldMode.equals(newMode)) { if ((type == MODIFY || type == RENAME) && !oldMode.equals(newMode)) {
o.write(encodeASCII("old mode ")); o.write(encodeASCII("old mode ")); //$NON-NLS-1$
oldMode.copyTo(o); oldMode.copyTo(o);
o.write('\n'); o.write('\n');
o.write(encodeASCII("new mode ")); o.write(encodeASCII("new mode ")); //$NON-NLS-1$
newMode.copyTo(o); newMode.copyTo(o);
o.write('\n'); o.write('\n');
} }
@ -1097,9 +1097,9 @@ public class DiffFormatter {
*/ */
protected void formatIndexLine(OutputStream o, DiffEntry ent) protected void formatIndexLine(OutputStream o, DiffEntry ent)
throws IOException { throws IOException {
o.write(encodeASCII("index " // o.write(encodeASCII("index " // //$NON-NLS-1$
+ format(ent.getOldId()) // + format(ent.getOldId()) //
+ ".." // + ".." // //$NON-NLS-1$
+ format(ent.getNewId()))); + format(ent.getNewId())));
if (ent.getOldMode().equals(ent.getNewMode())) { if (ent.getOldMode().equals(ent.getNewMode())) {
o.write(' '); o.write(' ');
@ -1133,8 +1133,8 @@ public class DiffFormatter {
break; break;
} }
o.write(encode("--- " + oldp + "\n")); o.write(encode("--- " + oldp + "\n")); //$NON-NLS-1$ //$NON-NLS-2$
o.write(encode("+++ " + newp + "\n")); o.write(encode("+++ " + newp + "\n")); //$NON-NLS-1$ //$NON-NLS-2$
} }
private int findCombinedEnd(final List<Edit> edits, final int i) { private int findCombinedEnd(final List<Edit> edits, final int i) {

1
org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java

@ -233,6 +233,7 @@ public class Edit {
return false; return false;
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
final Type t = getType(); final Type t = getType();

2
org.eclipse.jgit/src/org/eclipse/jgit/diff/EditList.java

@ -80,6 +80,6 @@ public class EditList extends ArrayList<Edit> {
@Override @Override
public String toString() { public String toString() {
return "EditList" + super.toString(); return "EditList" + super.toString(); //$NON-NLS-1$
} }
} }

6
org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java

@ -181,7 +181,7 @@ public class RawText extends Sequence {
*/ */
public String getString(int begin, int end, boolean dropLF) { public String getString(int begin, int end, boolean dropLF) {
if (begin == end) if (begin == end)
return ""; return ""; //$NON-NLS-1$
int s = getStart(begin); int s = getStart(begin);
int e = getEnd(end - 1); int e = getEnd(end - 1);
@ -290,8 +290,8 @@ public class RawText extends Sequence {
if (content[e - 1] != '\n') if (content[e - 1] != '\n')
return null; return null;
if (content.length > 1 && content[e - 2] == '\r') if (content.length > 1 && content[e - 2] == '\r')
return "\r\n"; return "\r\n"; //$NON-NLS-1$
else else
return "\n"; return "\n"; //$NON-NLS-1$
} }
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java

@ -320,8 +320,8 @@ class SimilarityRenameDetector {
} }
static int nameScore(String a, String b) { static int nameScore(String a, String b) {
int aDirLen = a.lastIndexOf("/") + 1; int aDirLen = a.lastIndexOf("/") + 1; //$NON-NLS-1$
int bDirLen = b.lastIndexOf("/") + 1; int bDirLen = b.lastIndexOf("/") + 1; //$NON-NLS-1$
int dirMin = Math.min(aDirLen, bDirLen); int dirMin = Math.min(aDirLen, bDirLen);
int dirMax = Math.max(aDirLen, bDirLen); int dirMax = Math.max(aDirLen, bDirLen);

6
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java vendored

@ -555,7 +555,7 @@ public class DirCache {
private static String formatExtensionName(final byte[] hdr) private static String formatExtensionName(final byte[] hdr)
throws UnsupportedEncodingException { throws UnsupportedEncodingException {
return "'" + new String(hdr, 0, 4, "ISO-8859-1") + "'"; return "'" + new String(hdr, 0, 4, "ISO-8859-1") + "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
private static boolean is_DIRC(final byte[] hdr) { private static boolean is_DIRC(final byte[] hdr) {
@ -855,8 +855,8 @@ public class DirCache {
System.arraycopy(sortedEntries, 0, r, 0, sortedEntries.length); System.arraycopy(sortedEntries, 0, r, 0, sortedEntries.length);
return r; return r;
} }
if (!path.endsWith("/")) if (!path.endsWith("/")) //$NON-NLS-1$
path += "/"; path += "/"; //$NON-NLS-1$
final byte[] p = Constants.encode(path); final byte[] p = Constants.encode(path);
final int pLen = p.length; final int pLen = p.length;

2
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java vendored

@ -244,7 +244,7 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
private static IllegalStateException bad(final DirCacheEntry a, private static IllegalStateException bad(final DirCacheEntry a,
final String msg) { final String msg) {
return new IllegalStateException(msg + ": " + a.getStage() + " " return new IllegalStateException(msg + ": " + a.getStage() + " " //$NON-NLS-1$ //$NON-NLS-2$
+ a.getPathString()); + a.getPathString());
} }
} }

12
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java vendored

@ -417,7 +417,7 @@ public class DirCacheCheckout {
builder.finish(); builder.finish();
File file = null; File file = null;
String last = ""; String last = ""; //$NON-NLS-1$
// when deleting files process them in the opposite order as they have // when deleting files process them in the opposite order as they have
// been reported. This ensures the files are deleted before we delete // been reported. This ensures the files are deleted before we delete
// their parent folders // their parent folders
@ -965,7 +965,7 @@ public class DirCacheCheckout {
ObjectLoader ol = or.open(entry.getObjectId()); ObjectLoader ol = or.open(entry.getObjectId());
File parentDir = f.getParentFile(); File parentDir = f.getParentFile();
parentDir.mkdirs(); parentDir.mkdirs();
File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir); //$NON-NLS-1$
WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY); WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY);
FileOutputStream rawChannel = new FileOutputStream(tmpFile); FileOutputStream rawChannel = new FileOutputStream(tmpFile);
OutputStream channel; OutputStream channel;
@ -1007,10 +1007,10 @@ public class DirCacheCheckout {
private static byte[][] forbidden; private static byte[][] forbidden;
static { static {
String[] list = new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", String[] list = new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", "LPT2", "COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", "LPT2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"PRN" }; "PRN" }; //$NON-NLS-1$
forbidden = new byte[list.length][]; forbidden = new byte[list.length][];
for (int i = 0; i < list.length; ++i) for (int i = 0; i < list.length; ++i)
forbidden[i] = Constants.encodeASCII(list[i]); forbidden[i] = Constants.encodeASCII(list[i]);

1
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java vendored

@ -637,6 +637,7 @@ public class DirCacheEntry {
/** /**
* Use for debugging only ! * Use for debugging only !
*/ */
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
return getFileMode() + " " + getLength() + " " + getLastModified() return getFileMode() + " " + getLength() + " " + getLastModified()

2
org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java

@ -77,7 +77,7 @@ public class CheckoutConflictException extends IOException {
private static String buildList(String[] files) { private static String buildList(String[] files) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for (String f : files) { for (String f : files) {
builder.append("\n"); builder.append("\n"); //$NON-NLS-1$
builder.append(f); builder.append(f);
} }
return builder.toString(); return builder.toString();

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java

@ -58,9 +58,9 @@ public class CompoundException extends Exception {
final StringBuilder msg = new StringBuilder(); final StringBuilder msg = new StringBuilder();
msg.append(JGitText.get().failureDueToOneOfTheFollowing); msg.append(JGitText.get().failureDueToOneOfTheFollowing);
for (final Throwable c : causes) { for (final Throwable c : causes) {
msg.append(" "); msg.append(" "); //$NON-NLS-1$
msg.append(c.getMessage()); msg.append(c.getMessage());
msg.append("\n"); msg.append("\n"); //$NON-NLS-1$
} }
return msg.toString(); return msg.toString();
} }

6
org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java

@ -69,11 +69,11 @@ public class InvalidObjectIdException extends IllegalArgumentException {
private static String asAscii(byte[] bytes, int offset, int length) { private static String asAscii(byte[] bytes, int offset, int length) {
try { try {
return ": " + new String(bytes, offset, length, "US-ASCII"); return ": " + new String(bytes, offset, length, "US-ASCII"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (UnsupportedEncodingException e2) { } catch (UnsupportedEncodingException e2) {
return ""; return ""; //$NON-NLS-1$
} catch (StringIndexOutOfBoundsException e2) { } catch (StringIndexOutOfBoundsException e2) {
return ""; return ""; //$NON-NLS-1$
} }
} }
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java

@ -60,10 +60,10 @@ public class MissingBundlePrerequisiteException extends TransportException {
final StringBuilder r = new StringBuilder(); final StringBuilder r = new StringBuilder();
r.append(JGitText.get().missingPrerequisiteCommits); r.append(JGitText.get().missingPrerequisiteCommits);
for (final Map.Entry<ObjectId, String> e : missingCommits.entrySet()) { for (final Map.Entry<ObjectId, String> e : missingCommits.entrySet()) {
r.append("\n "); r.append("\n "); //$NON-NLS-1$
r.append(e.getKey().name()); r.append(e.getKey().name());
if (e.getValue() != null) if (e.getValue() != null)
r.append(" ").append(e.getValue()); r.append(" ").append(e.getValue()); //$NON-NLS-1$
} }
return r.toString(); return r.toString();
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/PackProtocolException.java

@ -63,7 +63,7 @@ public class PackProtocolException extends TransportException {
* message * message
*/ */
public PackProtocolException(final URIish uri, final String s) { public PackProtocolException(final URIish uri, final String s) {
super(uri + ": " + s); super(uri + ": " + s); //$NON-NLS-1$
} }
/** /**
@ -79,7 +79,7 @@ public class PackProtocolException extends TransportException {
*/ */
public PackProtocolException(final URIish uri, final String s, public PackProtocolException(final URIish uri, final String s,
final Throwable cause) { final Throwable cause) {
this(uri + ": " + s, cause); this(uri + ": " + s, cause); //$NON-NLS-1$
} }
/** /**

2
org.eclipse.jgit/src/org/eclipse/jgit/errors/RevisionSyntaxException.java

@ -79,6 +79,6 @@ public class RevisionSyntaxException extends IllegalArgumentException {
@Override @Override
public String toString() { public String toString() {
return super.toString() + ":" + revstr; return super.toString() + ":" + revstr; //$NON-NLS-1$
} }
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationBundleLoadingException.java

@ -65,8 +65,8 @@ public class TranslationBundleLoadingException extends TranslationBundleExceptio
* {@link ResourceBundle#getBundle(String, Locale)} method. * {@link ResourceBundle#getBundle(String, Locale)} method.
*/ */
public TranslationBundleLoadingException(Class bundleClass, Locale locale, Exception cause) { public TranslationBundleLoadingException(Class bundleClass, Locale locale, Exception cause) {
super("Loading of translation bundle failed for [" super("Loading of translation bundle failed for [" //$NON-NLS-1$
+ bundleClass.getName() + ", " + locale.toString() + "]", + bundleClass.getName() + ", " + locale.toString() + "]", //$NON-NLS-1$ //$NON-NLS-2$
bundleClass, locale, cause); bundleClass, locale, cause);
} }
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/TranslationStringMissingException.java

@ -69,8 +69,8 @@ public class TranslationStringMissingException extends TranslationBundleExceptio
* {@link ResourceBundle#getString(String)} method. * {@link ResourceBundle#getString(String)} method.
*/ */
public TranslationStringMissingException(Class bundleClass, Locale locale, String key, Exception cause) { public TranslationStringMissingException(Class bundleClass, Locale locale, String key, Exception cause) {
super("Translation missing for [" + bundleClass.getName() + ", " super("Translation missing for [" + bundleClass.getName() + ", " //$NON-NLS-1$ //$NON-NLS-2$
+ locale.toString() + ", " + key + "]", bundleClass, locale, + locale.toString() + ", " + key + "]", bundleClass, locale, //$NON-NLS-1$ //$NON-NLS-2$
cause); cause);
this.key = key; this.key = key;
} }

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/TransportException.java

@ -65,7 +65,7 @@ public class TransportException extends IOException {
* message * message
*/ */
public TransportException(final URIish uri, final String s) { public TransportException(final URIish uri, final String s) {
super(uri.setPass(null) + ": " + s); super(uri.setPass(null) + ": " + s); //$NON-NLS-1$
} }
/** /**
@ -81,7 +81,7 @@ public class TransportException extends IOException {
*/ */
public TransportException(final URIish uri, final String s, public TransportException(final URIish uri, final String s,
final Throwable cause) { final Throwable cause) {
this(uri.setPass(null) + ": " + s, cause); this(uri.setPass(null) + ": " + s, cause); //$NON-NLS-1$
} }
/** /**

2
org.eclipse.jgit/src/org/eclipse/jgit/errors/UnsupportedCredentialItem.java

@ -64,6 +64,6 @@ public class UnsupportedCredentialItem extends RuntimeException {
* message * message
*/ */
public UnsupportedCredentialItem(final URIish uri, final String s) { public UnsupportedCredentialItem(final URIish uri, final String s) {
super(uri.setPass(null) + ": " + s); super(uri.setPass(null) + ": " + s); //$NON-NLS-1$
} }
} }

1
org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerHandle.java

@ -64,6 +64,7 @@ public class ListenerHandle {
parent.remove(this); parent.remove(this);
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
return type.getSimpleName() + "[" + listener + "]"; return type.getSimpleName() + "[" + listener + "]";

1
org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java

@ -85,6 +85,7 @@ public abstract class RepositoryEvent<T extends RepositoryListener> {
*/ */
public abstract void dispatch(T listener); public abstract void dispatch(T listener);
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
String type = getClass().getSimpleName(); String type = getClass().getSimpleName();

10
org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java

@ -86,7 +86,7 @@ public class FileNameMatcher {
static final List<Head> EMPTY_HEAD_LIST = Collections.emptyList(); static final List<Head> EMPTY_HEAD_LIST = Collections.emptyList();
private static final Pattern characterClassStartPattern = Pattern private static final Pattern characterClassStartPattern = Pattern
.compile("\\[[.:=]"); .compile("\\[[.:=]"); //$NON-NLS-1$
private List<Head> headsStartValue; private List<Head> headsStartValue;
@ -185,7 +185,7 @@ public class FileNameMatcher {
int firstValidEndBracketIndex = indexOfStartBracket + 2; int firstValidEndBracketIndex = indexOfStartBracket + 2;
if (indexOfStartBracket + 1 >= pattern.length()) if (indexOfStartBracket + 1 >= pattern.length())
throw new NoClosingBracketException(indexOfStartBracket, "[", "]", throw new NoClosingBracketException(indexOfStartBracket, "[", "]", //$NON-NLS-1$ //$NON-NLS-2$
pattern); pattern);
if (pattern.charAt(firstValidCharClassIndex) == '!') { if (pattern.charAt(firstValidCharClassIndex) == '!') {
@ -202,8 +202,8 @@ public class FileNameMatcher {
final int possibleGroupEnd = pattern.indexOf(']', final int possibleGroupEnd = pattern.indexOf(']',
firstValidEndBracketIndex); firstValidEndBracketIndex);
if (possibleGroupEnd == -1) if (possibleGroupEnd == -1)
throw new NoClosingBracketException(indexOfStartBracket, "[", throw new NoClosingBracketException(indexOfStartBracket, "[", //$NON-NLS-1$
"]", pattern); "]", pattern); //$NON-NLS-1$
final boolean foundCharClass = charClassStartMatcher final boolean foundCharClass = charClassStartMatcher
.find(firstValidCharClassIndex); .find(firstValidCharClassIndex);
@ -212,7 +212,7 @@ public class FileNameMatcher {
&& charClassStartMatcher.start() < possibleGroupEnd) { && charClassStartMatcher.start() < possibleGroupEnd) {
final String classStart = charClassStartMatcher.group(0); final String classStart = charClassStartMatcher.group(0);
final String classEnd = classStart.charAt(1) + "]"; final String classEnd = classStart.charAt(1) + "]"; //$NON-NLS-1$
final int classStartIndex = charClassStartMatcher.start(); final int classStartIndex = charClassStartMatcher.start();
final int classEndIndex = pattern.indexOf(classEnd, final int classEndIndex = pattern.indexOf(classEnd,

34
org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java

@ -57,7 +57,7 @@ final class GroupHead extends AbstractHead {
private final List<CharacterPattern> characterClasses; private final List<CharacterPattern> characterClasses;
private static final Pattern REGEX_PATTERN = Pattern private static final Pattern REGEX_PATTERN = Pattern
.compile("([^-][-][^-]|\\[[.:=].*?[.:=]\\])"); .compile("([^-][-][^-]|\\[[.:=].*?[.:=]\\])"); //$NON-NLS-1$
private final boolean inverse; private final boolean inverse;
@ -65,7 +65,7 @@ final class GroupHead extends AbstractHead {
throws InvalidPatternException { throws InvalidPatternException {
super(false); super(false);
this.characterClasses = new ArrayList<CharacterPattern>(); this.characterClasses = new ArrayList<CharacterPattern>();
this.inverse = pattern.startsWith("!"); this.inverse = pattern.startsWith("!"); //$NON-NLS-1$
if (inverse) { if (inverse) {
pattern = pattern.substring(1); pattern = pattern.substring(1);
} }
@ -76,40 +76,40 @@ final class GroupHead extends AbstractHead {
final char start = characterClass.charAt(0); final char start = characterClass.charAt(0);
final char end = characterClass.charAt(2); final char end = characterClass.charAt(2);
characterClasses.add(new CharacterRange(start, end)); characterClasses.add(new CharacterRange(start, end));
} else if (characterClass.equals("[:alnum:]")) { } else if (characterClass.equals("[:alnum:]")) { //$NON-NLS-1$
characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(LetterPattern.INSTANCE);
characterClasses.add(DigitPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE);
} else if (characterClass.equals("[:alpha:]")) { } else if (characterClass.equals("[:alpha:]")) { //$NON-NLS-1$
characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(LetterPattern.INSTANCE);
} else if (characterClass.equals("[:blank:]")) { } else if (characterClass.equals("[:blank:]")) { //$NON-NLS-1$
characterClasses.add(new OneCharacterPattern(' ')); characterClasses.add(new OneCharacterPattern(' '));
characterClasses.add(new OneCharacterPattern('\t')); characterClasses.add(new OneCharacterPattern('\t'));
} else if (characterClass.equals("[:cntrl:]")) { } else if (characterClass.equals("[:cntrl:]")) { //$NON-NLS-1$
characterClasses.add(new CharacterRange('\u0000', '\u001F')); characterClasses.add(new CharacterRange('\u0000', '\u001F'));
characterClasses.add(new OneCharacterPattern('\u007F')); characterClasses.add(new OneCharacterPattern('\u007F'));
} else if (characterClass.equals("[:digit:]")) { } else if (characterClass.equals("[:digit:]")) { //$NON-NLS-1$
characterClasses.add(DigitPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE);
} else if (characterClass.equals("[:graph:]")) { } else if (characterClass.equals("[:graph:]")) { //$NON-NLS-1$
characterClasses.add(new CharacterRange('\u0021', '\u007E')); characterClasses.add(new CharacterRange('\u0021', '\u007E'));
characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(LetterPattern.INSTANCE);
characterClasses.add(DigitPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE);
} else if (characterClass.equals("[:lower:]")) { } else if (characterClass.equals("[:lower:]")) { //$NON-NLS-1$
characterClasses.add(LowerPattern.INSTANCE); characterClasses.add(LowerPattern.INSTANCE);
} else if (characterClass.equals("[:print:]")) { } else if (characterClass.equals("[:print:]")) { //$NON-NLS-1$
characterClasses.add(new CharacterRange('\u0020', '\u007E')); characterClasses.add(new CharacterRange('\u0020', '\u007E'));
characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(LetterPattern.INSTANCE);
characterClasses.add(DigitPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE);
} else if (characterClass.equals("[:punct:]")) { } else if (characterClass.equals("[:punct:]")) { //$NON-NLS-1$
characterClasses.add(PunctPattern.INSTANCE); characterClasses.add(PunctPattern.INSTANCE);
} else if (characterClass.equals("[:space:]")) { } else if (characterClass.equals("[:space:]")) { //$NON-NLS-1$
characterClasses.add(WhitespacePattern.INSTANCE); characterClasses.add(WhitespacePattern.INSTANCE);
} else if (characterClass.equals("[:upper:]")) { } else if (characterClass.equals("[:upper:]")) { //$NON-NLS-1$
characterClasses.add(UpperPattern.INSTANCE); characterClasses.add(UpperPattern.INSTANCE);
} else if (characterClass.equals("[:xdigit:]")) { } else if (characterClass.equals("[:xdigit:]")) { //$NON-NLS-1$
characterClasses.add(new CharacterRange('0', '9')); characterClasses.add(new CharacterRange('0', '9'));
characterClasses.add(new CharacterRange('a', 'f')); characterClasses.add(new CharacterRange('a', 'f'));
characterClasses.add(new CharacterRange('A', 'F')); characterClasses.add(new CharacterRange('A', 'F'));
} else if (characterClass.equals("[:word:]")) { } else if (characterClass.equals("[:word:]")) { //$NON-NLS-1$
characterClasses.add(new OneCharacterPattern('_')); characterClasses.add(new OneCharacterPattern('_'));
characterClasses.add(LetterPattern.INSTANCE); characterClasses.add(LetterPattern.INSTANCE);
characterClasses.add(DigitPattern.INSTANCE); characterClasses.add(DigitPattern.INSTANCE);
@ -120,7 +120,7 @@ final class GroupHead extends AbstractHead {
throw new InvalidPatternException(message, wholePattern); throw new InvalidPatternException(message, wholePattern);
} }
pattern = matcher.replaceFirst(""); pattern = matcher.replaceFirst(""); //$NON-NLS-1$
matcher.reset(pattern); matcher.reset(pattern);
} }
// pattern contains now no ranges // pattern contains now no ranges
@ -219,7 +219,7 @@ final class GroupHead extends AbstractHead {
private static final class PunctPattern implements CharacterPattern { private static final class PunctPattern implements CharacterPattern {
static final GroupHead.PunctPattern INSTANCE = new PunctPattern(); static final GroupHead.PunctPattern INSTANCE = new PunctPattern();
private static String punctCharacters = "-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; private static String punctCharacters = "-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; //$NON-NLS-1$
public boolean matches(char c) { public boolean matches(char c) {
return punctCharacters.indexOf(c) != -1; return punctCharacters.indexOf(c) != -1;

2
org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java

@ -102,7 +102,7 @@ public class IgnoreNode {
String txt; String txt;
while ((txt = br.readLine()) != null) { while ((txt = br.readLine()) != null) {
txt = txt.trim(); txt = txt.trim();
if (txt.length() > 0 && !txt.startsWith("#")) if (txt.length() > 0 && !txt.startsWith("#")) //$NON-NLS-1$
rules.add(new IgnoreRule(txt)); rules.add(new IgnoreRule(txt));
} }
} }

24
org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreRule.java

@ -82,28 +82,28 @@ public class IgnoreRule {
private void setup() { private void setup() {
int startIndex = 0; int startIndex = 0;
int endIndex = pattern.length(); int endIndex = pattern.length();
if (pattern.startsWith("!")) { if (pattern.startsWith("!")) { //$NON-NLS-1$
startIndex++; startIndex++;
negation = true; negation = true;
} }
if (pattern.endsWith("/")) { if (pattern.endsWith("/")) { //$NON-NLS-1$
endIndex --; endIndex --;
dirOnly = true; dirOnly = true;
} }
pattern = pattern.substring(startIndex, endIndex); pattern = pattern.substring(startIndex, endIndex);
boolean hasSlash = pattern.contains("/"); boolean hasSlash = pattern.contains("/"); //$NON-NLS-1$
if (!hasSlash) if (!hasSlash)
nameOnly = true; nameOnly = true;
else if (!pattern.startsWith("/")) { else if (!pattern.startsWith("/")) { //$NON-NLS-1$
//Contains "/" but does not start with one //Contains "/" but does not start with one
//Adding / to the start should not interfere with matching //Adding / to the start should not interfere with matching
pattern = "/" + pattern; pattern = "/" + pattern; //$NON-NLS-1$
} }
if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
try { try {
matcher = new FileNameMatcher(pattern, Character.valueOf('/')); matcher = new FileNameMatcher(pattern, Character.valueOf('/'));
} catch (InvalidPatternException e) { } catch (InvalidPatternException e) {
@ -164,8 +164,8 @@ public class IgnoreRule {
* the target is ignored. Call {@link IgnoreRule#getResult() getResult()} for the result. * the target is ignored. Call {@link IgnoreRule#getResult() getResult()} for the result.
*/ */
public boolean isMatch(String target, boolean isDirectory) { public boolean isMatch(String target, boolean isDirectory) {
if (!target.startsWith("/")) if (!target.startsWith("/")) //$NON-NLS-1$
target = "/" + target; target = "/" + target; //$NON-NLS-1$
if (matcher == null) { if (matcher == null) {
if (target.equals(pattern)) { if (target.equals(pattern)) {
@ -183,12 +183,12 @@ public class IgnoreRule {
* "/src/new" to /src/newfile" but allows "/src/new" to match * "/src/new" to /src/newfile" but allows "/src/new" to match
* "/src/new/newfile", as is the git standard * "/src/new/newfile", as is the git standard
*/ */
if ((target).startsWith(pattern + "/")) if ((target).startsWith(pattern + "/")) //$NON-NLS-1$
return true; return true;
if (nameOnly) { if (nameOnly) {
//Iterate through each sub-name //Iterate through each sub-name
final String[] segments = target.split("/"); final String[] segments = target.split("/"); //$NON-NLS-1$
for (int idx = 0; idx < segments.length; idx++) { for (int idx = 0; idx < segments.length; idx++) {
final String segmentName = segments[idx]; final String segmentName = segments[idx];
if (segmentName.equals(pattern) && if (segmentName.equals(pattern) &&
@ -202,7 +202,7 @@ public class IgnoreRule {
if (matcher.isMatch()) if (matcher.isMatch())
return true; return true;
final String[] segments = target.split("/"); final String[] segments = target.split("/"); //$NON-NLS-1$
if (nameOnly) { if (nameOnly) {
for (int idx = 0; idx < segments.length; idx++) { for (int idx = 0; idx < segments.length; idx++) {
final String segmentName = segments[idx]; final String segmentName = segments[idx];
@ -220,7 +220,7 @@ public class IgnoreRule {
for (int idx = 0; idx < segments.length; idx++) { for (int idx = 0; idx < segments.length; idx++) {
final String segmentName = segments[idx]; final String segmentName = segments[idx];
if (segmentName.length() > 0) { if (segmentName.length() > 0) {
matcher.append("/" + segmentName); matcher.append("/" + segmentName); //$NON-NLS-1$
} }
if (matcher.isMatch() && if (matcher.isMatch() &&

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java

@ -375,8 +375,9 @@ public final class AbbreviatedObjectId implements Serializable {
return new String(b, 0, nibbles); return new String(b, 0, nibbles);
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
return "AbbreviatedObjectId[" + name() + "]"; return "AbbreviatedObjectId[" + name() + "]"; //$NON-NLS-1$
} }
} }

1
org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java

@ -489,6 +489,7 @@ public abstract class AnyObjectId implements Comparable<Object> {
dst[o--] = '0'; dst[o--] = '0';
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
return "AnyObjectId[" + name() + "]"; return "AnyObjectId[" + name() + "]";

6
org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java

@ -487,7 +487,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re
*/ */
public B findGitDir() { public B findGitDir() {
if (getGitDir() == null) if (getGitDir() == null)
findGitDir(new File("").getAbsoluteFile()); findGitDir(new File("").getAbsoluteFile()); //$NON-NLS-1$
return self(); return self();
} }
@ -628,7 +628,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re
if (getGitDir() == null) if (getGitDir() == null)
setGitDir(getWorkTree().getParentFile()); setGitDir(getWorkTree().getParentFile());
if (getIndexFile() == null) if (getIndexFile() == null)
setIndexFile(new File(getGitDir(), "index")); setIndexFile(new File(getGitDir(), "index")); //$NON-NLS-1$
} }
} }
@ -640,7 +640,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re
*/ */
protected void setupInternals() throws IOException { protected void setupInternals() throws IOException {
if (getObjectDirectory() == null && getGitDir() != null) if (getObjectDirectory() == null && getGitDir() != null)
setObjectDirectory(safeFS().resolve(getGitDir(), "objects")); setObjectDirectory(safeFS().resolve(getGitDir(), "objects")); //$NON-NLS-1$
} }
/** /**

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java

@ -168,7 +168,7 @@ public class BatchRefUpdate {
if (msg == null && !appendStatus) if (msg == null && !appendStatus)
disableRefLog(); disableRefLog();
else if (msg == null && appendStatus) { else if (msg == null && appendStatus) {
refLogMessage = ""; refLogMessage = ""; //$NON-NLS-1$
refLogIncludeResult = true; refLogIncludeResult = true;
} else { } else {
refLogMessage = msg; refLogMessage = msg;

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java

@ -69,7 +69,7 @@ public abstract class BatchingProgressMonitor implements ProgressMonitor {
public Thread newThread(Runnable taskBody) { public Thread newThread(Runnable taskBody) {
Thread thr = baseFactory.newThread(taskBody); Thread thr = baseFactory.newThread(taskBody);
thr.setName("JGit-AlarmQueue"); thr.setName("JGit-AlarmQueue"); //$NON-NLS-1$
thr.setDaemon(true); thr.setDaemon(true);
return thr; return thr;
} }

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java

@ -81,7 +81,7 @@ public class BranchConfig {
if (remote == null || mergeRef == null) if (remote == null || mergeRef == null)
return null; return null;
if (remote.equals(".")) if (remote.equals(".")) //$NON-NLS-1$
return mergeRef; return mergeRef;
return findRemoteTrackingBranch(remote, mergeRef); return findRemoteTrackingBranch(remote, mergeRef);

11
org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java

@ -66,15 +66,15 @@ import java.util.List;
public class CommitBuilder { public class CommitBuilder {
private static final ObjectId[] EMPTY_OBJECTID_LIST = new ObjectId[0]; private static final ObjectId[] EMPTY_OBJECTID_LIST = new ObjectId[0];
private static final byte[] htree = Constants.encodeASCII("tree"); private static final byte[] htree = Constants.encodeASCII("tree"); //$NON-NLS-1$
private static final byte[] hparent = Constants.encodeASCII("parent"); private static final byte[] hparent = Constants.encodeASCII("parent"); //$NON-NLS-1$
private static final byte[] hauthor = Constants.encodeASCII("author"); private static final byte[] hauthor = Constants.encodeASCII("author"); //$NON-NLS-1$
private static final byte[] hcommitter = Constants.encodeASCII("committer"); private static final byte[] hcommitter = Constants.encodeASCII("committer"); //$NON-NLS-1$
private static final byte[] hencoding = Constants.encodeASCII("encoding"); private static final byte[] hencoding = Constants.encodeASCII("encoding"); //$NON-NLS-1$
private ObjectId treeId; private ObjectId treeId;
@ -322,6 +322,7 @@ public class CommitBuilder {
return build(); return build();
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
StringBuilder r = new StringBuilder(); StringBuilder r = new StringBuilder();

38
org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

@ -134,24 +134,24 @@ public class Config {
r.append('"'); r.append('"');
inquote = false; inquote = false;
} }
r.append("\\n\\\n"); r.append("\\n\\\n"); //$NON-NLS-1$
lineStart = r.length(); lineStart = r.length();
break; break;
case '\t': case '\t':
r.append("\\t"); r.append("\\t"); //$NON-NLS-1$
break; break;
case '\b': case '\b':
r.append("\\b"); r.append("\\b"); //$NON-NLS-1$
break; break;
case '\\': case '\\':
r.append("\\\\"); r.append("\\\\"); //$NON-NLS-1$
break; break;
case '"': case '"':
r.append("\\\""); r.append("\\\""); //$NON-NLS-1$
break; break;
case ';': case ';':
@ -354,7 +354,7 @@ public class Config {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static <T> T[] allValuesOf(final T value) { private static <T> T[] allValuesOf(final T value) {
try { try {
return (T[]) value.getClass().getMethod("values").invoke(null); return (T[]) value.getClass().getMethod("values").invoke(null); //$NON-NLS-1$
} catch (Exception err) { } catch (Exception err) {
String typeName = value.getClass().getName(); String typeName = value.getClass().getName();
String msg = MessageFormat.format( String msg = MessageFormat.format(
@ -393,9 +393,9 @@ public class Config {
for (T e : all) { for (T e : all) {
if (StringUtils.equalsIgnoreCase(e.name(), n)) if (StringUtils.equalsIgnoreCase(e.name(), n))
return e; return e;
else if (StringUtils.equalsIgnoreCase(e.name(), "TRUE")) else if (StringUtils.equalsIgnoreCase(e.name(), "TRUE")) //$NON-NLS-1$
trueState = e; trueState = e;
else if (StringUtils.equalsIgnoreCase(e.name(), "FALSE")) else if (StringUtils.equalsIgnoreCase(e.name(), "FALSE")) //$NON-NLS-1$
falseState = e; falseState = e;
} }
@ -664,11 +664,11 @@ public class Config {
final String s; final String s;
if (value >= GiB && (value % GiB) == 0) if (value >= GiB && (value % GiB) == 0)
s = String.valueOf(value / GiB) + " g"; s = String.valueOf(value / GiB) + " g"; //$NON-NLS-1$
else if (value >= MiB && (value % MiB) == 0) else if (value >= MiB && (value % MiB) == 0)
s = String.valueOf(value / MiB) + " m"; s = String.valueOf(value / MiB) + " m"; //$NON-NLS-1$
else if (value >= KiB && (value % KiB) == 0) else if (value >= KiB && (value % KiB) == 0)
s = String.valueOf(value / KiB) + " k"; s = String.valueOf(value / KiB) + " k"; //$NON-NLS-1$
else else
s = String.valueOf(value); s = String.valueOf(value);
@ -695,7 +695,7 @@ public class Config {
*/ */
public void setBoolean(final String section, final String subsection, public void setBoolean(final String section, final String subsection,
final String name, final boolean value) { final String name, final boolean value) {
setString(section, subsection, name, value ? "true" : "false"); setString(section, subsection, name, value ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
} }
/** /**
@ -937,8 +937,8 @@ public class Config {
out.append(' '); out.append(' ');
String escaped = escapeValue(e.subsection); String escaped = escapeValue(e.subsection);
// make sure to avoid double quotes here // make sure to avoid double quotes here
boolean quoted = escaped.startsWith("\"") boolean quoted = escaped.startsWith("\"") //$NON-NLS-1$
&& escaped.endsWith("\""); && escaped.endsWith("\""); //$NON-NLS-1$
if (!quoted) if (!quoted)
out.append('"'); out.append('"');
out.append(escaped); out.append(escaped);
@ -947,11 +947,11 @@ public class Config {
} }
out.append(']'); out.append(']');
} else if (e.section != null && e.name != null) { } else if (e.section != null && e.name != null) {
if (e.prefix == null || "".equals(e.prefix)) if (e.prefix == null || "".equals(e.prefix)) //$NON-NLS-1$
out.append('\t'); out.append('\t');
out.append(e.name); out.append(e.name);
if (MAGIC_EMPTY_VALUE != e.value) { if (MAGIC_EMPTY_VALUE != e.value) {
out.append(" ="); out.append(" ="); //$NON-NLS-1$
if (e.value != null) { if (e.value != null) {
out.append(' '); out.append(' ');
out.append(escapeValue(e.value)); out.append(escapeValue(e.value));
@ -1005,7 +1005,7 @@ public class Config {
} else if (e.section == null && Character.isWhitespace(c)) { } else if (e.section == null && Character.isWhitespace(c)) {
// Save the leading whitespace (if any). // Save the leading whitespace (if any).
if (e.prefix == null) if (e.prefix == null)
e.prefix = ""; e.prefix = ""; //$NON-NLS-1$
e.prefix += c; e.prefix += c;
} else if ('[' == c) { } else if ('[' == c) {
@ -1018,7 +1018,7 @@ public class Config {
} }
if (']' != input) if (']' != input)
throw new ConfigInvalidException(JGitText.get().badGroupHeader); throw new ConfigInvalidException(JGitText.get().badGroupHeader);
e.suffix = ""; e.suffix = ""; //$NON-NLS-1$
} else if (last != null) { } else if (last != null) {
// Read a value. // Read a value.
@ -1026,7 +1026,7 @@ public class Config {
e.subsection = last.subsection; e.subsection = last.subsection;
in.reset(); in.reset();
e.name = readKeyName(in); e.name = readKeyName(in);
if (e.name.endsWith("\n")) { if (e.name.endsWith("\n")) { //$NON-NLS-1$
e.name = e.name.substring(0, e.name.length() - 1); e.name = e.name.substring(0, e.name.length() - 1);
e.value = MAGIC_EMPTY_VALUE; e.value = MAGIC_EMPTY_VALUE;
} else } else

1
org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java

@ -47,6 +47,7 @@ package org.eclipse.jgit.lib;
* Constants for use with the Configuration classes: section names, * Constants for use with the Configuration classes: section names,
* configuration keys * configuration keys
*/ */
@SuppressWarnings("nls")
public class ConfigConstants { public class ConfigConstants {
/** The "core" section */ /** The "core" section */
public static final String CONFIG_CORE_SECTION = "core"; public static final String CONFIG_CORE_SECTION = "core";

1
org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java

@ -112,6 +112,7 @@ class ConfigLine {
return a.equals(b); return a.equals(b);
} }
@SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
if (section == null) if (section == null)

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java

@ -98,7 +98,7 @@ class ConfigSnapshot {
Set<String> getNames(String section, String subsection) { Set<String> getNames(String section, String subsection) {
List<ConfigLine> s = sorted(); List<ConfigLine> s = sorted();
int idx = find(s, section, subsection, ""); int idx = find(s, section, subsection, ""); //$NON-NLS-1$
if (idx < 0) if (idx < 0)
idx = -(idx + 1); idx = -(idx + 1);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save