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: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590tags/v2.3.0.201302130906
@@ -66,11 +66,11 @@ public class ConsoleAuthenticator extends CachedAuthenticator { | |||
@Override | |||
protected PasswordAuthentication promptPasswordAuthentication() { | |||
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()) { | |||
return null; | |||
} | |||
char[] password = cons.readPassword(ConsoleText.get().password + " "); | |||
char[] password = cons.readPassword(ConsoleText.get().password + " "); //$NON-NLS-1$ | |||
if (password == null) { | |||
password = new char[0]; | |||
} | |||
@@ -81,10 +81,10 @@ public class ConsoleAuthenticator extends CachedAuthenticator { | |||
final StringBuilder realm = new StringBuilder(); | |||
if (getRequestorType() == RequestorType.PROXY) { | |||
realm.append(getRequestorType()); | |||
realm.append(" "); | |||
realm.append(" "); //$NON-NLS-1$ | |||
realm.append(getRequestingHost()); | |||
if (getRequestingPort() > 0) { | |||
realm.append(":"); | |||
realm.append(":"); //$NON-NLS-1$ | |||
realm.append(getRequestingPort()); | |||
} | |||
} else { |
@@ -118,7 +118,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { | |||
private boolean get(CredentialItem.StringType item) { | |||
if (item.isValueSecure()) { | |||
char[] v = cons.readPassword("%s: ", item.getPromptText()); | |||
char[] v = cons.readPassword("%s: ", item.getPromptText()); //$NON-NLS-1$ | |||
if (v != null) { | |||
item.setValue(new String(v)); | |||
return true; | |||
@@ -126,7 +126,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { | |||
return false; | |||
} | |||
} else { | |||
String v = cons.readLine("%s: ", item.getPromptText()); | |||
String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$ | |||
if (v != null) { | |||
item.setValue(v); | |||
return true; | |||
@@ -138,7 +138,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { | |||
private boolean get(CredentialItem.CharArrayType item) { | |||
if (item.isValueSecure()) { | |||
char[] v = cons.readPassword("%s: ", item.getPromptText()); | |||
char[] v = cons.readPassword("%s: ", item.getPromptText()); //$NON-NLS-1$ | |||
if (v != null) { | |||
item.setValueNoCopy(v); | |||
return true; | |||
@@ -146,7 +146,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { | |||
return false; | |||
} | |||
} else { | |||
String v = cons.readLine("%s: ", item.getPromptText()); | |||
String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$ | |||
if (v != null) { | |||
item.setValueNoCopy(v.toCharArray()); | |||
return true; | |||
@@ -157,13 +157,13 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { | |||
} | |||
private boolean get(CredentialItem.InformationalMessage item) { | |||
cons.printf("%s\n", item.getPromptText()); | |||
cons.printf("%s\n", item.getPromptText()); //$NON-NLS-1$ | |||
cons.flush(); | |||
return true; | |||
} | |||
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); | |||
if (r != null) { | |||
item.setValue(ConsoleText.get().answerYes.equalsIgnoreCase(r)); |
@@ -84,7 +84,7 @@ abstract class AbstractFetchCommand extends TextBuiltin { | |||
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); | |||
outw.println(); | |||
} | |||
@@ -150,18 +150,18 @@ abstract class AbstractFetchCommand extends TextBuiltin { | |||
if (r == RefUpdate.Result.FORCED) { | |||
final String aOld = safeAbbreviate(reader, u.getOldObjectId()); | |||
final String aNew = safeAbbreviate(reader, u.getNewObjectId()); | |||
return aOld + "..." + aNew; | |||
return aOld + "..." + aNew; //$NON-NLS-1$ | |||
} | |||
if (r == RefUpdate.Result.FAST_FORWARD) { | |||
final String aOld = safeAbbreviate(reader, u.getOldObjectId()); | |||
final String aNew = safeAbbreviate(reader, u.getNewObjectId()); | |||
return aOld + ".." + aNew; | |||
return aOld + ".." + aNew; //$NON-NLS-1$ | |||
} | |||
if (r == RefUpdate.Result.NO_CHANGE) | |||
return "[up to date]"; | |||
return "[" + r.name() + "]"; | |||
return "[" + r.name() + "]"; //$NON-NLS-1$//$NON-NLS-2$ | |||
} | |||
private String safeAbbreviate(ObjectReader reader, ObjectId id) { |
@@ -83,7 +83,7 @@ class AmazonS3Client extends TextBuiltin { | |||
protected void run() throws Exception { | |||
final AmazonS3 s3 = new AmazonS3(properties()); | |||
if ("get".equals(op)) { | |||
if ("get".equals(op)) { //$NON-NLS-1$ | |||
final URLConnection c = s3.get(bucket, key); | |||
int len = c.getContentLength(); | |||
final InputStream in = c.getInputStream(); | |||
@@ -104,14 +104,14 @@ class AmazonS3Client extends TextBuiltin { | |||
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)) | |||
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); | |||
} else if ("put".equals(op)) { | |||
} else if ("put".equals(op)) { //$NON-NLS-1$ | |||
final OutputStream os = s3.beginPut(bucket, key, null, null); | |||
final byte[] tmp = new byte[2048]; | |||
int n; |
@@ -143,16 +143,16 @@ class Blame extends TextBuiltin { | |||
} | |||
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) | |||
root = db.getConfig().getBoolean("blame", "blankboundary", false); | |||
root = db.getConfig().getBoolean("blame", "blankboundary", false); //$NON-NLS-1$ //$NON-NLS-2$ | |||
if (!root) | |||
root = db.getConfig().getBoolean("blame", "showroot", false); | |||
root = db.getConfig().getBoolean("blame", "showroot", false); //$NON-NLS-1$ //$NON-NLS-2$ | |||
if (showRawTimestamp) | |||
dateFmt = new SimpleDateFormat("ZZZZ"); | |||
dateFmt = new SimpleDateFormat("ZZZZ"); //$NON-NLS-1$ | |||
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); | |||
reader = db.newObjectReader(); | |||
@@ -170,7 +170,7 @@ class Blame extends TextBuiltin { | |||
} | |||
generator.reverse(rangeStart, rangeEnd); | |||
} else if (revision != null) { | |||
generator.push(null, db.resolve(revision + "^{commit}")); | |||
generator.push(null, db.resolve(revision + "^{commit}")); //$NON-NLS-1$ | |||
} else { | |||
generator.push(null, db.resolve(Constants.HEAD)); | |||
if (!db.isBare()) { | |||
@@ -203,12 +203,12 @@ class Blame extends TextBuiltin { | |||
maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line)); | |||
} | |||
String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); | |||
String numFmt = MessageFormat.format(" %{0}d", | |||
String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); //$NON-NLS-1$ | |||
String numFmt = MessageFormat.format(" %{0}d", //$NON-NLS-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))); | |||
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", | |||
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$ | |||
valueOf(authorWidth), valueOf(dateWidth)); | |||
for (int line = begin; line < end; line++) { | |||
@@ -233,8 +233,8 @@ class Blame extends TextBuiltin { | |||
private void parseLineRangeOption() { | |||
String beginStr, endStr; | |||
if (rangeString.startsWith("/")) { | |||
int c = rangeString.indexOf("/,", 1); | |||
if (rangeString.startsWith("/")) { //$NON-NLS-1$ | |||
int c = rangeString.indexOf("/,", 1); //$NON-NLS-1$ | |||
if (c < 0) { | |||
beginStr = rangeString; | |||
endStr = String.valueOf(end); | |||
@@ -249,7 +249,7 @@ class Blame extends TextBuiltin { | |||
beginStr = rangeString; | |||
endStr = String.valueOf(end); | |||
} else if (c == 0) { | |||
beginStr = "0"; | |||
beginStr = "0"; //$NON-NLS-1$ | |||
endStr = rangeString.substring(1); | |||
} else { | |||
beginStr = rangeString.substring(0, c); | |||
@@ -257,20 +257,20 @@ class Blame extends TextBuiltin { | |||
} | |||
} | |||
if (beginStr.equals("")) | |||
if (beginStr.equals("")) //$NON-NLS-1$ | |||
begin = 0; | |||
else if (beginStr.startsWith("/")) | |||
else if (beginStr.startsWith("/")) //$NON-NLS-1$ | |||
begin = findLine(0, beginStr); | |||
else | |||
begin = Math.max(0, Integer.parseInt(beginStr) - 1); | |||
if (endStr.equals("")) | |||
if (endStr.equals("")) //$NON-NLS-1$ | |||
end = blame.getResultContents().size(); | |||
else if (endStr.startsWith("/")) | |||
else if (endStr.startsWith("/")) //$NON-NLS-1$ | |||
end = findLine(begin, endStr); | |||
else if (endStr.startsWith("-")) | |||
else if (endStr.startsWith("-")) //$NON-NLS-1$ | |||
end = begin + Integer.parseInt(endStr); | |||
else if (endStr.startsWith("+")) | |||
else if (endStr.startsWith("+")) //$NON-NLS-1$ | |||
end = begin + Integer.parseInt(endStr.substring(1)); | |||
else | |||
end = Math.max(0, Integer.parseInt(endStr) - 1); | |||
@@ -278,10 +278,10 @@ class Blame extends TextBuiltin { | |||
private int findLine(int b, String regex) { | |||
String re = regex.substring(1, regex.length() - 1); | |||
if (!re.startsWith("^")) | |||
re = ".*" + re; | |||
if (!re.endsWith("$")) | |||
re = re + ".*"; | |||
if (!re.startsWith("^")) //$NON-NLS-1$ | |||
re = ".*" + re; //$NON-NLS-1$ | |||
if (!re.endsWith("$")) //$NON-NLS-1$ | |||
re = re + ".*"; //$NON-NLS-1$ | |||
Pattern p = Pattern.compile(re); | |||
RawText text = blame.getResultContents(); | |||
for (int line = b; line < text.size(); line++) { | |||
@@ -293,30 +293,30 @@ class Blame extends TextBuiltin { | |||
private String path(int line) { | |||
String p = blame.getSourcePath(line); | |||
return p != null ? p : ""; | |||
return p != null ? p : ""; //$NON-NLS-1$ | |||
} | |||
private String author(int line) { | |||
PersonIdent author = blame.getSourceAuthor(line); | |||
if (author == null) | |||
return ""; | |||
return ""; //$NON-NLS-1$ | |||
String name = showAuthorEmail ? author.getEmailAddress() : author | |||
.getName(); | |||
return name != null ? name : ""; | |||
return name != null ? name : ""; //$NON-NLS-1$ | |||
} | |||
private String date(int line) { | |||
if (blame.getSourceCommit(line) == null) | |||
return ""; | |||
return ""; //$NON-NLS-1$ | |||
PersonIdent author = blame.getSourceAuthor(line); | |||
if (author == null) | |||
return ""; | |||
return ""; //$NON-NLS-1$ | |||
dateFmt.setTimeZone(author.getTimeZone()); | |||
if (!showRawTimestamp) | |||
return dateFmt.format(author.getWhen()); | |||
return String.format("%d %s", | |||
return String.format("%d %s", //$NON-NLS-1$ | |||
valueOf(author.getWhen().getTime() / 1000L), | |||
dateFmt.format(author.getWhen())); | |||
} | |||
@@ -338,9 +338,9 @@ class Blame extends TextBuiltin { | |||
} else if (!root && commit.getParentCount() == 0) { | |||
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 | |||
r = "^" + reader.abbreviate(commit, abbrev).name(); | |||
r = "^" + reader.abbreviate(commit, abbrev).name(); //$NON-NLS-1$ | |||
} else { | |||
if (showLongRevision) | |||
r = commit.name(); |
@@ -145,7 +145,7 @@ class Branch extends TextBuiltin { | |||
else | |||
startBranch = Constants.HEAD; | |||
Ref startRef = db.getRef(startBranch); | |||
ObjectId startAt = db.resolve(startBranch + "^0"); | |||
ObjectId startAt = db.resolve(startBranch + "^0"); //$NON-NLS-1$ | |||
if (startRef != null) | |||
startBranch = startRef.getName(); | |||
else | |||
@@ -180,7 +180,7 @@ class Branch extends TextBuiltin { | |||
if (head != null) { | |||
String current = head.getLeaf().getName(); | |||
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_REMOTES, remote); | |||
@@ -220,7 +220,7 @@ class Branch extends TextBuiltin { | |||
outw.print(ref); | |||
if (verbose) { | |||
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(); | |||
outw.print(reader.abbreviate(objectId).name()); | |||
outw.print(' '); |
@@ -110,7 +110,7 @@ class Clone extends AbstractFetchCommand { | |||
dst = new FileRepository(gitdir); | |||
dst.create(); | |||
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(); | |||
db = dst; | |||
@@ -131,8 +131,8 @@ class Clone extends AbstractFetchCommand { | |||
final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName); | |||
rc.addURI(uri); | |||
rc.addFetchRefSpec(new RefSpec().setForceUpdate(true) | |||
.setSourceDestination(Constants.R_HEADS + "*", | |||
Constants.R_REMOTES + remoteName + "/*")); | |||
.setSourceDestination(Constants.R_HEADS + "*", //$NON-NLS-1$ | |||
Constants.R_REMOTES + remoteName + "/*")); //$NON-NLS-1$ | |||
rc.update(dstcfg); | |||
dstcfg.save(); | |||
} |
@@ -132,7 +132,7 @@ public class CommandCatalog { | |||
private Enumeration<URL> catalogs() { | |||
try { | |||
final String pfx = "META-INF/services/"; | |||
final String pfx = "META-INF/services/"; //$NON-NLS-1$ | |||
return ldr.getResources(pfx + TextBuiltin.class.getName()); | |||
} catch (IOException err) { | |||
return new Vector<URL>().elements(); | |||
@@ -143,7 +143,7 @@ public class CommandCatalog { | |||
final BufferedReader cIn; | |||
try { | |||
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) { | |||
// If we cannot read from the service list, go to the next. | |||
// | |||
@@ -153,7 +153,7 @@ public class CommandCatalog { | |||
try { | |||
String line; | |||
while ((line = cIn.readLine()) != null) { | |||
if (line.length() > 0 && !line.startsWith("#")) | |||
if (line.length() > 0 && !line.startsWith("#")) //$NON-NLS-1$ | |||
load(line); | |||
} | |||
} catch (IOException err) { |
@@ -76,13 +76,13 @@ public class CommandRef { | |||
private CommandRef(final Class<? extends TextBuiltin> clazz, final String cn) { | |||
impl = clazz; | |||
name = cn; | |||
usage = ""; | |||
usage = ""; //$NON-NLS-1$ | |||
} | |||
private static String guessName(final Class<? extends TextBuiltin> clazz) { | |||
final StringBuilder s = new StringBuilder(); | |||
if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) | |||
s.append("debug-"); | |||
if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) //$NON-NLS-1$ | |||
s.append("debug-"); //$NON-NLS-1$ | |||
boolean lastWasDash = true; | |||
for (final char c : clazz.getSimpleName().toCharArray()) { |
@@ -109,7 +109,7 @@ class Commit extends TextBuiltin { | |||
if (branchName.startsWith(Constants.R_HEADS)) | |||
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()); | |||
} | |||
} |
@@ -103,7 +103,7 @@ class Config extends TextBuiltin { | |||
Set<String> names = config.getNames(section); | |||
for (String name : names) { | |||
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()) { | |||
for (String subsection : config.getSubsections(section)) { | |||
@@ -111,8 +111,8 @@ class Config extends TextBuiltin { | |||
for (String name : names) { | |||
for (String value : config.getStringList(section, | |||
subsection, name)) | |||
outw.println(section + "." + subsection + "." | |||
+ name + "=" + value); | |||
outw.println(section + "." + subsection + "." //$NON-NLS-1$ //$NON-NLS-2$ | |||
+ name + "=" + value); //$NON-NLS-1$ | |||
} | |||
} | |||
} |
@@ -161,8 +161,8 @@ class Diff extends TextBuiltin { | |||
@Option(name = "--no-prefix", usage = "usage_noPrefix") | |||
void noPrefix(@SuppressWarnings("unused") boolean on) { | |||
diffFmt.setOldPrefix(""); | |||
diffFmt.setNewPrefix(""); | |||
diffFmt.setOldPrefix(""); //$NON-NLS-1$ | |||
diffFmt.setNewPrefix(""); //$NON-NLS-1$ | |||
} | |||
// END -- Options shared with Log | |||
@@ -179,7 +179,7 @@ class Diff extends TextBuiltin { | |||
try { | |||
if (cached) { | |||
if (oldTree == null) { | |||
ObjectId head = db.resolve(HEAD + "^{tree}"); | |||
ObjectId head = db.resolve(HEAD + "^{tree}"); //$NON-NLS-1$ | |||
if (head == null) | |||
die(MessageFormat.format(CLIText.get().notATree, HEAD)); | |||
CanonicalTreeParser p = new CanonicalTreeParser(); | |||
@@ -227,21 +227,21 @@ class Diff extends TextBuiltin { | |||
for (DiffEntry ent : files) { | |||
switch (ent.getChangeType()) { | |||
case ADD: | |||
out.println("A\t" + ent.getNewPath()); | |||
out.println("A\t" + ent.getNewPath()); //$NON-NLS-1$ | |||
break; | |||
case DELETE: | |||
out.println("D\t" + ent.getOldPath()); | |||
out.println("D\t" + ent.getOldPath()); //$NON-NLS-1$ | |||
break; | |||
case MODIFY: | |||
out.println("M\t" + ent.getNewPath()); | |||
out.println("M\t" + ent.getNewPath()); //$NON-NLS-1$ | |||
break; | |||
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()); | |||
out.println(); | |||
break; | |||
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()); | |||
out.println(); | |||
break; |
@@ -104,7 +104,7 @@ class Glog extends RevWalkTextBuiltin { | |||
graphPane.getCommitList().source(walk); | |||
graphPane.getCommitList().fillTo(Integer.MAX_VALUE); | |||
frame.setTitle("[" + repoName() + "]"); | |||
frame.setTitle("[" + repoName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ | |||
frame.pack(); | |||
frame.setVisible(true); | |||
return graphPane.getCommitList().size(); |
@@ -171,8 +171,8 @@ class Log extends RevWalkTextBuiltin { | |||
@Option(name = "--no-prefix", usage = "usage_noPrefix") | |||
void noPrefix(@SuppressWarnings("unused") boolean on) { | |||
diffFmt.setOldPrefix(""); | |||
diffFmt.setNewPrefix(""); | |||
diffFmt.setOldPrefix(""); //$NON-NLS-1$ | |||
diffFmt.setNewPrefix(""); //$NON-NLS-1$ | |||
} | |||
// END -- Options shared with Diff | |||
@@ -238,18 +238,18 @@ class Log extends RevWalkTextBuiltin { | |||
@Override | |||
protected void show(final RevCommit c) throws Exception { | |||
outw.print(CLIText.get().commitLabel); | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
c.getId().copyTo(outbuffer, outw); | |||
if (decorate) { | |||
Collection<Ref> list = allRefsByPeeledObjectId.get(c); | |||
if (list != null) { | |||
outw.print(" ("); | |||
outw.print(" ("); //$NON-NLS-1$ | |||
for (Iterator<Ref> i = list.iterator(); i.hasNext(); ) { | |||
outw.print(i.next().getName()); | |||
if (i.hasNext()) | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
} | |||
outw.print(")"); | |||
outw.print(")"); //$NON-NLS-1$ | |||
} | |||
} | |||
outw.println(); | |||
@@ -260,9 +260,9 @@ class Log extends RevWalkTextBuiltin { | |||
dateFormatter.formatDate(author))); | |||
outw.println(); | |||
final String[] lines = c.getFullMessage().split("\n"); | |||
final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ | |||
for (final String s : lines) { | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
outw.print(s); | |||
outw.println(); | |||
} | |||
@@ -324,16 +324,16 @@ class Log extends RevWalkTextBuiltin { | |||
outw.println(); | |||
outw.print("Notes"); | |||
if (label != null) { | |||
outw.print(" ("); | |||
outw.print(" ("); //$NON-NLS-1$ | |||
outw.print(label); | |||
outw.print(")"); | |||
outw.print(")"); //$NON-NLS-1$ | |||
} | |||
outw.println(":"); | |||
outw.println(":"); //$NON-NLS-1$ | |||
try { | |||
RawText rawText = new RawText(argWalk.getObjectReader() | |||
.open(blobId).getCachedBytes(Integer.MAX_VALUE)); | |||
for (int i = 0; i < rawText.size(); i++) { | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
outw.println(rawText.getString(i)); | |||
} | |||
} catch (LargeObjectException e) { |
@@ -71,7 +71,7 @@ class LsRemote extends TextBuiltin { | |||
for (final Ref r : c.getRefs()) { | |||
show(r.getObjectId(), r.getName()); | |||
if (r.getPeeledObjectId() != null) | |||
show(r.getPeeledObjectId(), r.getName() + "^{}"); | |||
show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ | |||
} | |||
} finally { | |||
c.close(); |
@@ -128,7 +128,7 @@ public class Main { | |||
&& err instanceof TransportException) | |||
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())); | |||
if (showStackTrace) | |||
err.printStackTrace(); | |||
@@ -163,7 +163,7 @@ public class Main { | |||
if (argv.length == 0 || help) { | |||
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) { | |||
writer.println(); | |||
clp.printUsage(writer, CLIText.get().resourceBundle()); | |||
@@ -226,8 +226,8 @@ public class Main { | |||
private static boolean installConsole() { | |||
try { | |||
install("org.eclipse.jgit.console.ConsoleAuthenticator"); | |||
install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); | |||
install("org.eclipse.jgit.console.ConsoleAuthenticator"); //$NON-NLS-1$ | |||
install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); //$NON-NLS-1$ | |||
return true; | |||
} catch (ClassNotFoundException e) { | |||
return false; | |||
@@ -253,7 +253,7 @@ public class Main { | |||
throws IllegalAccessException, InvocationTargetException, | |||
NoSuchMethodException, ClassNotFoundException { | |||
try { | |||
Class.forName(name).getMethod("install").invoke(null); | |||
Class.forName(name).getMethod("install").invoke(null); //$NON-NLS-1$ | |||
} catch (InvocationTargetException e) { | |||
if (e.getCause() instanceof RuntimeException) | |||
throw (RuntimeException) e.getCause(); | |||
@@ -276,23 +276,23 @@ public class Main { | |||
* the value in <code>http_proxy</code> is unsupportable. | |||
*/ | |||
private static void configureHttpProxy() throws MalformedURLException { | |||
final String s = System.getenv("http_proxy"); | |||
if (s == null || s.equals("")) | |||
final String s = System.getenv("http_proxy"); //$NON-NLS-1$ | |||
if (s == null || s.equals("")) //$NON-NLS-1$ | |||
return; | |||
final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); | |||
if (!"http".equals(u.getProtocol())) | |||
final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$ | |||
if (!"http".equals(u.getProtocol())) //$NON-NLS-1$ | |||
throw new MalformedURLException(MessageFormat.format(CLIText.get().invalidHttpProxyOnlyHttpSupported, s)); | |||
final String proxyHost = u.getHost(); | |||
final int proxyPort = u.getPort(); | |||
System.setProperty("http.proxyHost", proxyHost); | |||
System.setProperty("http.proxyHost", proxyHost); //$NON-NLS-1$ | |||
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(); | |||
if (userpass != null && userpass.contains(":")) { | |||
if (userpass != null && userpass.contains(":")) { //$NON-NLS-1$ | |||
final int c = userpass.indexOf(':'); | |||
final String user = userpass.substring(0, c); | |||
final String pass = userpass.substring(c + 1); |
@@ -103,7 +103,7 @@ class Merge extends TextBuiltin { | |||
// determine the other revision we want to merge with HEAD | |||
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) | |||
throw die(MessageFormat.format( | |||
CLIText.get().refDoesNotExistOrNoCommit, ref)); | |||
@@ -144,11 +144,11 @@ class Merge extends TextBuiltin { | |||
case DIRTY_WORKTREE: | |||
case DIRTY_INDEX: | |||
outw.println(CLIText.get().dontOverwriteLocalChanges); | |||
outw.println(" " + entry.getKey()); | |||
outw.println(" " + entry.getKey()); //$NON-NLS-1$ | |||
break; | |||
case COULD_NOT_DELETE: | |||
outw.println(CLIText.get().cannotDeleteFile); | |||
outw.println(" " + entry.getKey()); | |||
outw.println(" " + entry.getKey()); //$NON-NLS-1$ | |||
break; | |||
} | |||
break; | |||
@@ -157,7 +157,7 @@ class Merge extends TextBuiltin { | |||
if (!isMergedInto(oldHead, src)) | |||
name = mergeStrategy.getName(); | |||
else | |||
name = "recursive"; | |||
name = "recursive"; //$NON-NLS-1$ | |||
outw.println(MessageFormat.format(CLIText.get().mergeMadeBy, name)); | |||
break; | |||
case MERGED_SQUASHED: |
@@ -194,7 +194,7 @@ class Push extends TextBuiltin { | |||
final char flag = fastForward ? ' ' : '+'; | |||
final String summary = safeAbbreviate(reader, oldRef | |||
.getObjectId()) | |||
+ (fastForward ? ".." : "...") | |||
+ (fastForward ? ".." : "...") //$NON-NLS-1$ //$NON-NLS-2$ | |||
+ safeAbbreviate(reader, rru.getNewObjectId()); | |||
final String message = fastForward ? null : CLIText.get().forcedUpdate; | |||
printUpdateLine(flag, summary, srcRef, remoteName, message); | |||
@@ -252,14 +252,14 @@ class Push extends TextBuiltin { | |||
private void printUpdateLine(final char flag, final String summary, | |||
final String srcRef, final String destRef, final String message) | |||
throws IOException { | |||
outw.format(" %c %-17s", valueOf(flag), summary); | |||
outw.format(" %c %-17s", valueOf(flag), summary); //$NON-NLS-1$ | |||
if (srcRef != null) | |||
outw.format(" %s ->", abbreviateRef(srcRef, true)); | |||
outw.format(" %s", abbreviateRef(destRef, true)); | |||
outw.format(" %s ->", abbreviateRef(srcRef, true)); //$NON-NLS-1$ | |||
outw.format(" %s", abbreviateRef(destRef, true)); //$NON-NLS-1$ | |||
if (message != null) | |||
outw.format(" (%s)", message); | |||
outw.format(" (%s)", message); //$NON-NLS-1$ | |||
outw.println(); | |||
} |
@@ -73,14 +73,14 @@ class Reflog extends TextBuiltin { | |||
private String toString(ReflogEntry entry, int i) { | |||
final StringBuilder s = new StringBuilder(); | |||
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("@{" + i + "}:"); | |||
s.append(" "); | |||
s.append("@{" + i + "}:"); //$NON-NLS-1$ //$NON-NLS-2$ | |||
s.append(" "); //$NON-NLS-1$ | |||
// temporary workaround for bug 393463 | |||
if (entry.getOldId().equals(ObjectId.zeroId())) | |||
s.append(entry.getComment().replaceFirst("^commit:", | |||
"commit (initial):")); | |||
s.append(entry.getComment().replaceFirst("^commit:", //$NON-NLS-1$ | |||
"commit (initial):")); //$NON-NLS-1$ | |||
else | |||
s.append(entry.getComment()); | |||
return s.toString(); |
@@ -154,14 +154,14 @@ class Show extends TextBuiltin { | |||
@Option(name = "--no-prefix", usage = "usage_noPrefix") | |||
void noPrefix(@SuppressWarnings("unused") boolean on) { | |||
diffFmt.setOldPrefix(""); | |||
diffFmt.setNewPrefix(""); | |||
diffFmt.setOldPrefix(""); //$NON-NLS-1$ | |||
diffFmt.setNewPrefix(""); //$NON-NLS-1$ | |||
} | |||
// END -- Options shared with Diff | |||
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") | |||
@@ -198,7 +198,7 @@ class Show extends TextBuiltin { | |||
break; | |||
case Constants.OBJ_TREE: | |||
outw.print("tree "); | |||
outw.print("tree "); //$NON-NLS-1$ | |||
outw.print(objectName); | |||
outw.println(); | |||
outw.println(); | |||
@@ -225,7 +225,7 @@ class Show extends TextBuiltin { | |||
private void show(RevTag tag) throws IOException { | |||
outw.print(CLIText.get().tagLabel); | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
outw.print(tag.getTagName()); | |||
outw.println(); | |||
@@ -241,9 +241,9 @@ class Show extends TextBuiltin { | |||
} | |||
outw.println(); | |||
final String[] lines = tag.getFullMessage().split("\n"); | |||
final String[] lines = tag.getFullMessage().split("\n"); //$NON-NLS-1$ | |||
for (final String s : lines) { | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
outw.print(s); | |||
outw.println(); | |||
} | |||
@@ -261,7 +261,7 @@ class Show extends TextBuiltin { | |||
outw.print(walk.getPathString()); | |||
final FileMode mode = walk.getFileMode(0); | |||
if (mode == FileMode.TREE) | |||
outw.print("/"); | |||
outw.print("/"); //$NON-NLS-1$ | |||
outw.println(); | |||
} | |||
} | |||
@@ -270,7 +270,7 @@ class Show extends TextBuiltin { | |||
char[] outbuffer = new char[Constants.OBJECT_ID_LENGTH * 2]; | |||
outw.print(CLIText.get().commitLabel); | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
c.getId().copyTo(outbuffer, outw); | |||
outw.println(); | |||
@@ -284,9 +284,9 @@ class Show extends TextBuiltin { | |||
fmt.format(author.getWhen()))); | |||
outw.println(); | |||
final String[] lines = c.getFullMessage().split("\n"); | |||
final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ | |||
for (final String s : lines) { | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
outw.print(s); | |||
outw.println(); | |||
} |
@@ -60,7 +60,7 @@ class ShowRef extends TextBuiltin { | |||
for (final Ref r : getSortedRefs()) { | |||
show(r.getObjectId(), r.getName()); | |||
if (r.getPeeledObjectId() != null) | |||
show(r.getPeeledObjectId(), r.getName() + "^{}"); | |||
show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ | |||
} | |||
} | |||
@@ -99,7 +99,7 @@ class Status extends TextBuiltin { | |||
int nbNotStagedForCommit = notStagedForCommit.size(); | |||
if (nbNotStagedForCommit > 0) { | |||
if (!firstHeader) | |||
printSectionHeader(""); | |||
printSectionHeader(""); //$NON-NLS-1$ | |||
printSectionHeader(CLIText.get().changesNotStagedForCommit); | |||
printList(CLIText.get().statusModified, | |||
CLIText.get().statusRemoved, null, notStagedForCommit, | |||
@@ -109,7 +109,7 @@ class Status extends TextBuiltin { | |||
int nbUnmerged = unmerged.size(); | |||
if (nbUnmerged > 0) { | |||
if (!firstHeader) | |||
printSectionHeader(""); | |||
printSectionHeader(""); //$NON-NLS-1$ | |||
printSectionHeader(CLIText.get().unmergedPaths); | |||
printList(unmerged); | |||
firstHeader = false; | |||
@@ -117,7 +117,7 @@ class Status extends TextBuiltin { | |||
int nbUntracked = untracked.size(); | |||
if (nbUntracked > 0) { | |||
if (!firstHeader) | |||
printSectionHeader(""); | |||
printSectionHeader(""); //$NON-NLS-1$ | |||
printSectionHeader(CLIText.get().untrackedFiles); | |||
printList(untracked); | |||
} | |||
@@ -127,8 +127,8 @@ class Status extends TextBuiltin { | |||
throws IOException { | |||
outw.println(CLIText.formatLine(MessageFormat | |||
.format(pattern, arguments))); | |||
if (!pattern.equals("")) | |||
outw.println(CLIText.formatLine("")); | |||
if (!pattern.equals("")) //$NON-NLS-1$ | |||
outw.println(CLIText.formatLine("")); //$NON-NLS-1$ | |||
outw.flush(); | |||
} | |||
@@ -68,7 +68,7 @@ class Tag extends TextBuiltin { | |||
private boolean force; | |||
@Option(name = "-m", metaVar = "metaVar_message", usage = "usage_tagMessage") | |||
private String message = ""; | |||
private String message = ""; //$NON-NLS-1$ | |||
@Argument(index = 0, metaVar = "metaVar_name") | |||
private String tagName; |
@@ -134,8 +134,7 @@ public abstract class TextBuiltin { | |||
protected void init(final Repository repository, final String gitDir) { | |||
try { | |||
final String outputEncoding = repository != null ? repository | |||
.getConfig() | |||
.getString("i18n", null, "logOutputEncoding") : null; | |||
.getConfig().getString("i18n", null, "logOutputEncoding") : null; //$NON-NLS-1$ //$NON-NLS-2$ | |||
if (outs == null) | |||
outs = new FileOutputStream(FileDescriptor.out); | |||
BufferedWriter bufw; | |||
@@ -208,7 +207,7 @@ public abstract class TextBuiltin { | |||
* @param 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) { | |||
PrintWriter writer = new PrintWriter(System.err); | |||
writer.println(message); | |||
writer.print("jgit "); | |||
writer.print("jgit "); //$NON-NLS-1$ | |||
writer.print(commandName); | |||
clp.printSingleLineUsage(writer, getResourceBundle()); | |||
writer.println(); |
@@ -260,11 +260,11 @@ class DiffAlgorithms extends TextBuiltin { | |||
"Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on"); | |||
outw.format("%-25s %12s ( %12s %12s )\n", // | |||
"", "", "N=" + minN, "N=" + maxN); | |||
outw.println("-----------------------------------------------------" | |||
+ "----------------"); | |||
outw.println("-----------------------------------------------------" //$NON-NLS-1$ | |||
+ "----------------"); //$NON-NLS-1$ | |||
for (Test test : all) { | |||
outw.format("%-25s %12d ( %12d %12d )", // | |||
outw.format("%-25s %12d ( %12d %12d )", // //$NON-NLS-1$ | |||
test.algorithm.name, // | |||
valueOf(test.runningTimeNanos), // | |||
valueOf(test.minN.runningTimeNanos), // |
@@ -59,7 +59,7 @@ class ReadDirCache extends TextBuiltin { | |||
for (int i = 0; i < cnt; i++) | |||
db.readDirCache(); | |||
final long end = System.currentTimeMillis(); | |||
outw.print(" "); | |||
outw.print(" "); //$NON-NLS-1$ | |||
outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, | |||
valueOf((end - start) / cnt))); | |||
} |
@@ -95,7 +95,7 @@ import org.kohsuke.args4j.Option; | |||
* <p> | |||
*/ | |||
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") | |||
boolean really; | |||
@@ -138,7 +138,7 @@ class RebuildCommitGraph extends TextBuiltin { | |||
try { | |||
String line; | |||
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]); | |||
try { | |||
rw.parseCommit(oldId); | |||
@@ -165,8 +165,8 @@ class RebuildCommitGraph extends TextBuiltin { | |||
pm.beginTask("Rewriting commits", queue.size()); | |||
final ObjectInserter oi = db.newObjectInserter(); | |||
final ObjectId emptyTree = oi.insert(Constants.OBJ_TREE, new byte[] {}); | |||
final PersonIdent me = new PersonIdent("jgit rebuild-commitgraph", | |||
"rebuild-commitgraph@localhost"); | |||
final PersonIdent me = new PersonIdent("jgit rebuild-commitgraph", //$NON-NLS-1$ | |||
"rebuild-commitgraph@localhost"); //$NON-NLS-1$ | |||
while (!queue.isEmpty()) { | |||
final ListIterator<ToRewrite> itr = queue | |||
.listIterator(queue.size()); | |||
@@ -196,7 +196,7 @@ class RebuildCommitGraph extends TextBuiltin { | |||
newc.setAuthor(new PersonIdent(me, new Date(t.commitTime))); | |||
newc.setCommitter(newc.getAuthor()); | |||
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); | |||
rewrites.put(t.oldId, t.newId); | |||
pm.update(1); | |||
@@ -277,7 +277,7 @@ class RebuildCommitGraph extends TextBuiltin { | |||
try { | |||
String line; | |||
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 String type = parts[1]; | |||
final String name = parts[2]; |
@@ -103,7 +103,7 @@ class ShowCommands extends TextBuiltin { | |||
final ClassLoader ldr = c.getImplementationClassLoader(); | |||
String cn = c.getImplementationClassName(); | |||
cn = cn.replace('.', '/') + ".class"; | |||
cn = cn.replace('.', '/') + ".class"; //$NON-NLS-1$ | |||
final URL url = ldr.getResource(cn); | |||
if (url == null) { |
@@ -71,7 +71,7 @@ class ShowDirCache extends TextBuiltin { | |||
final int stage = ent.getStage(); | |||
outw.print(mode); | |||
outw.format(" %6d", valueOf(len)); | |||
outw.format(" %6d", valueOf(len)); //$NON-NLS-1$ | |||
outw.print(' '); | |||
outw.print(fmt.format(mtime)); | |||
outw.print(' '); |
@@ -347,19 +347,19 @@ class TextHashFunctions extends TextBuiltin { | |||
File parent = db.getDirectory().getParentFile(); | |||
if (name.equals(Constants.DOT_GIT) && parent != null) | |||
name = parent.getName(); | |||
outw.println(name + ":"); | |||
outw.println(name + ":"); //$NON-NLS-1$ | |||
} | |||
outw.format(" %6d files; %5d avg. unique lines/file\n", // | |||
valueOf(fileCnt), // | |||
valueOf(lineCnt / fileCnt)); | |||
outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len"); | |||
outw.println("-----------------------------------------------"); | |||
outw.println("-----------------------------------------------"); //$NON-NLS-1$ | |||
String lastHashName = null; | |||
for (Function fun : all) { | |||
String hashName = fun.hash.name; | |||
if (hashName.equals(lastHashName)) | |||
hashName = ""; | |||
outw.format("%-20s %-15s %9d\n", // | |||
hashName = ""; //$NON-NLS-1$ | |||
outw.format("%-20s %-15s %9d\n", // //$NON-NLS-1$ | |||
hashName, // | |||
fun.fold.name, // | |||
valueOf(fun.maxChainLength)); |
@@ -59,7 +59,7 @@ import org.kohsuke.args4j.Option; | |||
@Command(name = "eclipse-ipzilla", common = false, usage = "usage_synchronizeIPZillaData") | |||
class Ipzilla extends TextBuiltin { | |||
@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") | |||
private String username; |
@@ -127,13 +127,13 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { | |||
final ArrayList<String> tmp = new ArrayList<String>(args.length); | |||
for (int argi = 0; argi < args.length; argi++) { | |||
final String str = args[argi]; | |||
if (str.equals("--")) { | |||
if (str.equals("--")) { //$NON-NLS-1$ | |||
while (argi < args.length) | |||
tmp.add(args[argi++]); | |||
break; | |||
} | |||
if (str.startsWith("--")) { | |||
if (str.startsWith("--")) { //$NON-NLS-1$ | |||
final int eq = str.indexOf('='); | |||
if (eq > 0) { | |||
tmp.add(str.substring(0, eq)); |
@@ -88,12 +88,12 @@ public class RevCommitHandler extends OptionHandler<RevCommit> { | |||
String name = params.getParameter(0); | |||
boolean interesting = true; | |||
if (name.startsWith("^")) { | |||
if (name.startsWith("^")) { //$NON-NLS-1$ | |||
name = name.substring(1); | |||
interesting = false; | |||
} | |||
final int dot2 = name.indexOf(".."); | |||
final int dot2 = name.indexOf(".."); //$NON-NLS-1$ | |||
if (dot2 != -1) { | |||
if (!option.isMultiValued()) | |||
throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn |
@@ -176,7 +176,7 @@ final class AWTPlotRenderer extends AbstractPlotRenderer<SwingLane, Color> | |||
g.setBackground(new Color(colorComponents[0],colorComponents[1],colorComponents[2])); | |||
} | |||
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(); | |||
int textw = g.getFontMetrics().stringWidth(txt); |
@@ -75,13 +75,13 @@ public class AwtAuthenticator extends CachedAuthenticator { | |||
final StringBuilder instruction = new StringBuilder(); | |||
instruction.append(UIText.get().enterUsernameAndPasswordFor); | |||
instruction.append(" "); | |||
instruction.append(" "); //$NON-NLS-1$ | |||
if (getRequestorType() == RequestorType.PROXY) { | |||
instruction.append(getRequestorType()); | |||
instruction.append(" "); | |||
instruction.append(" "); //$NON-NLS-1$ | |||
instruction.append(getRequestingHost()); | |||
if (getRequestingPort() > 0) { | |||
instruction.append(":"); | |||
instruction.append(":"); //$NON-NLS-1$ | |||
instruction.append(getRequestingPort()); | |||
} | |||
} else { |
@@ -94,7 +94,8 @@ public class CommitGraphPane extends JTable { | |||
int h = 0; | |||
for (int i = 0; i<getColumnCount(); ++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); | |||
} | |||
setRowHeight(h + getRowMargin()); | |||
@@ -129,7 +130,7 @@ public class CommitGraphPane extends JTable { | |||
final TableColumn author = cols.getColumn(1); | |||
final TableColumn date = cols.getColumn(2); | |||
graph.setHeaderValue(""); | |||
graph.setHeaderValue(""); //$NON-NLS-1$ | |||
author.setHeaderValue(UIText.get().author); | |||
date.setHeaderValue(UIText.get().date); | |||
@@ -186,9 +187,9 @@ public class CommitGraphPane extends JTable { | |||
final String valueStr; | |||
if (pi != null) | |||
valueStr = pi.getName() + " <" + pi.getEmailAddress() + ">"; | |||
valueStr = pi.getName() + " <" + pi.getEmailAddress() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ | |||
else | |||
valueStr = ""; | |||
valueStr = ""; //$NON-NLS-1$ | |||
return super.getTableCellRendererComponent(table, valueStr, | |||
isSelected, hasFocus, row, column); | |||
} | |||
@@ -198,7 +199,7 @@ public class CommitGraphPane extends JTable { | |||
private static final long serialVersionUID = 1L; | |||
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, | |||
final Object value, final boolean isSelected, | |||
@@ -209,7 +210,7 @@ public class CommitGraphPane extends JTable { | |||
if (pi != null) | |||
valueStr = fmt.format(pi.getWhen()); | |||
else | |||
valueStr = ""; | |||
valueStr = ""; //$NON-NLS-1$ | |||
return super.getTableCellRendererComponent(table, valueStr, | |||
isSelected, hasFocus, row, column); | |||
} |
@@ -130,7 +130,7 @@ public class AddCommand extends GitCommand<DirCache> { | |||
checkCallable(); | |||
DirCache dc = null; | |||
boolean addAll = false; | |||
if (filepatterns.contains(".")) | |||
if (filepatterns.contains(".")) //$NON-NLS-1$ | |||
addAll = true; | |||
ObjectInserter inserter = repo.newObjectInserter(); |
@@ -227,14 +227,14 @@ public class ApplyCommand extends GitCommand<ApplyResult> { | |||
} | |||
} | |||
if (!isNoNewlineAtEndOfFile(fh)) | |||
newLines.add(""); | |||
newLines.add(""); //$NON-NLS-1$ | |||
if (!rt.isMissingNewlineAtEnd()) | |||
oldLines.add(""); | |||
oldLines.add(""); //$NON-NLS-1$ | |||
if (!isChanged(oldLines, newLines)) | |||
return; // don't touch the file | |||
StringBuilder sb = new StringBuilder(); | |||
final String eol = rt.size() == 0 | |||
|| (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt | |||
|| (rt.size() == 1 && rt.isMissingNewlineAtEnd()) ? "\n" : rt //$NON-NLS-1$ | |||
.getLineDelimiter(); | |||
for (String l : newLines) { | |||
sb.append(l); |
@@ -218,7 +218,7 @@ public class CheckoutCommand extends GitCommand<Ref> { | |||
Ref headRef = repo.getRef(Constants.HEAD); | |||
String shortHeadRef = getShortBranchName(headRef); | |||
String refLogMessage = "checkout: moving from " + shortHeadRef; | |||
String refLogMessage = "checkout: moving from " + shortHeadRef; //$NON-NLS-1$ | |||
ObjectId branch = repo.resolve(name); | |||
if (branch == null) | |||
throw new RefNotFoundException(MessageFormat.format(JGitText | |||
@@ -252,7 +252,7 @@ public class CheckoutCommand extends GitCommand<Ref> { | |||
String toName = Repository.shortenRefName(name); | |||
RefUpdate refUpdate = repo.updateRef(Constants.HEAD, ref == null); | |||
refUpdate.setForceUpdate(force); | |||
refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); | |||
refUpdate.setRefLogMessage(refLogMessage + " to " + toName, false); //$NON-NLS-1$ | |||
Result updateResult; | |||
if (ref != null) | |||
updateResult = refUpdate.link(ref.getName()); | |||
@@ -469,7 +469,7 @@ public class CheckoutCommand extends GitCommand<Ref> { | |||
&& (name == null || !Repository | |||
.isValidRefName(Constants.R_HEADS + name))) | |||
throw new InvalidRefNameException(MessageFormat.format(JGitText | |||
.get().branchNameInvalid, name == null ? "<null>" : name)); | |||
.get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$ | |||
} | |||
/** |
@@ -148,7 +148,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { | |||
String ourName = calculateOurName(headRef); | |||
String cherryPickName = srcCommit.getId().abbreviate(7).name() | |||
+ " " + srcCommit.getShortMessage(); | |||
+ " " + srcCommit.getShortMessage(); //$NON-NLS-1$ | |||
ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE | |||
.newMerger(repo); | |||
@@ -168,7 +168,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { | |||
newHead = new Git(getRepository()).commit() | |||
.setMessage(srcCommit.getFullMessage()) | |||
.setReflogComment( | |||
"cherry-pick: " | |||
"cherry-pick: " //$NON-NLS-1$ | |||
+ srcCommit.getShortMessage()) | |||
.setAuthor(srcCommit.getAuthorIdent()).call(); | |||
cherryPickedRefs.add(src); |
@@ -131,7 +131,7 @@ public class CleanCommand extends GitCommand<Set<String>> { | |||
if (!dryRun) | |||
FileUtils.delete(new File(repo.getWorkTree(), dir), | |||
FileUtils.RECURSIVE); | |||
files.add(dir + "/"); | |||
files.add(dir + "/"); //$NON-NLS-1$ | |||
} | |||
} catch (IOException e) { | |||
throw new JGitInternalException(e.getMessage(), e); |
@@ -158,7 +158,8 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { | |||
+ config.getName(); | |||
RefSpec refSpec = new RefSpec(); | |||
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.update(clonedRepo.getConfig()); |
@@ -159,7 +159,7 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
Git git = new Git(repo); | |||
try { | |||
git.add() | |||
.addFilepattern(".") | |||
.addFilepattern(".") //$NON-NLS-1$ | |||
.setUpdate(true).call(); | |||
} catch (NoFilepatternException e) { | |||
// should really not happen | |||
@@ -173,7 +173,7 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); | |||
// 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) | |||
throw new WrongRepositoryStateException( | |||
JGitText.get().commitAmendOnInitialNotPossible); | |||
@@ -226,7 +226,7 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
if (reflogComment != null) { | |||
ru.setRefLogMessage(reflogComment, false); | |||
} else { | |||
String prefix = amend ? "commit (amend): " | |||
String prefix = amend ? "commit (amend): " //$NON-NLS-1$ | |||
: "commit: "; | |||
ru.setRefLogMessage( | |||
prefix + revCommit.getShortMessage(), false); | |||
@@ -287,9 +287,9 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
author, committer, message); | |||
message = ChangeIdUtil.insertId(message, changeId); | |||
if (changeId != null) | |||
message = message.replaceAll("\nChange-Id: I" | |||
+ ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" | |||
+ changeId.getName() + "\n"); | |||
message = message.replaceAll("\nChange-Id: I" //$NON-NLS-1$ | |||
+ ObjectId.zeroId().getName() + "\n", "\nChange-Id: I" //$NON-NLS-1$ //$NON-NLS-2$ | |||
+ changeId.getName() + "\n"); //$NON-NLS-1$ | |||
} | |||
private DirCache createTemporaryIndex(ObjectId headId, DirCache index) | |||
@@ -455,7 +455,7 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
while (true) { | |||
if (p.equals(o)) | |||
return i; | |||
int l = p.lastIndexOf("/"); | |||
int l = p.lastIndexOf("/"); //$NON-NLS-1$ | |||
if (l < 1) | |||
break; | |||
p = p.substring(0, l); | |||
@@ -633,8 +633,8 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
checkCallable(); | |||
if (!only.isEmpty()) | |||
throw new JGitInternalException(MessageFormat.format( | |||
JGitText.get().illegalCombinationOfArguments, "--all", | |||
"--only")); | |||
JGitText.get().illegalCombinationOfArguments, "--all", //$NON-NLS-1$ | |||
"--only")); //$NON-NLS-1$ | |||
this.all = all; | |||
return this; | |||
} | |||
@@ -668,9 +668,9 @@ public class CommitCommand extends GitCommand<RevCommit> { | |||
checkCallable(); | |||
if (all) | |||
throw new JGitInternalException(MessageFormat.format( | |||
JGitText.get().illegalCombinationOfArguments, "--only", | |||
"--all")); | |||
String o = only.endsWith("/") ? only.substring(0, only.length() - 1) | |||
JGitText.get().illegalCombinationOfArguments, "--only", //$NON-NLS-1$ | |||
"--all")); //$NON-NLS-1$ | |||
String o = only.endsWith("/") ? only.substring(0, only.length() - 1) //$NON-NLS-1$ | |||
: only; | |||
// ignore duplicates | |||
if (!this.only.contains(o)) |
@@ -144,7 +144,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { | |||
// determine whether we are based on a commit, | |||
// a branch, or a tag and compose the reflog message | |||
String refLogMessage; | |||
String baseBranch = ""; | |||
String baseBranch = ""; //$NON-NLS-1$ | |||
if (startPointFullName == null) { | |||
String baseCommit; | |||
if (startCommit != null) | |||
@@ -155,26 +155,26 @@ public class CreateBranchCommand extends GitCommand<Ref> { | |||
baseCommit = commit.getShortMessage(); | |||
} | |||
if (exists) | |||
refLogMessage = "branch: Reset start-point to commit " | |||
refLogMessage = "branch: Reset start-point to commit " //$NON-NLS-1$ | |||
+ baseCommit; | |||
else | |||
refLogMessage = "branch: Created from commit " + baseCommit; | |||
refLogMessage = "branch: Created from commit " + baseCommit; //$NON-NLS-1$ | |||
} else if (startPointFullName.startsWith(Constants.R_HEADS) | |||
|| startPointFullName.startsWith(Constants.R_REMOTES)) { | |||
baseBranch = startPointFullName; | |||
if (exists) | |||
refLogMessage = "branch: Reset start-point to branch " | |||
refLogMessage = "branch: Reset start-point to branch " //$NON-NLS-1$ | |||
+ startPointFullName; // TODO | |||
else | |||
refLogMessage = "branch: Created from branch " + baseBranch; | |||
refLogMessage = "branch: Created from branch " + baseBranch; //$NON-NLS-1$ | |||
} else { | |||
startAt = revWalk.peel(revWalk.parseAny(startAt)); | |||
if (exists) | |||
refLogMessage = "branch: Reset start-point to tag " | |||
refLogMessage = "branch: Reset start-point to tag " //$NON-NLS-1$ | |||
+ startPointFullName; | |||
else | |||
refLogMessage = "branch: Created from tag " | |||
refLogMessage = "branch: Created from tag " //$NON-NLS-1$ | |||
+ startPointFullName; | |||
} | |||
@@ -233,9 +233,9 @@ public class CreateBranchCommand extends GitCommand<Ref> { | |||
String autosetupflag = repo.getConfig().getString( | |||
ConfigConstants.CONFIG_BRANCH_SECTION, null, | |||
ConfigConstants.CONFIG_KEY_AUTOSETUPMERGE); | |||
if ("false".equals(autosetupflag)) { | |||
if ("false".equals(autosetupflag)) { //$NON-NLS-1$ | |||
doConfigure = false; | |||
} else if ("always".equals(autosetupflag)) { | |||
} else if ("always".equals(autosetupflag)) { //$NON-NLS-1$ | |||
doConfigure = true; | |||
} else { | |||
// in this case, the default is to configure | |||
@@ -246,8 +246,8 @@ public class CreateBranchCommand extends GitCommand<Ref> { | |||
if (doConfigure) { | |||
StoredConfig config = repo.getConfig(); | |||
String[] tokens = baseBranch.split("/", 4); | |||
boolean isRemote = tokens[1].equals("remotes"); | |||
String[] tokens = baseBranch.split("/", 4); //$NON-NLS-1$ | |||
boolean isRemote = tokens[1].equals("remotes"); //$NON-NLS-1$ | |||
if (isRemote) { | |||
// refs/remotes/<remote name>/<branch> | |||
String remoteName = tokens[2]; | |||
@@ -262,7 +262,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { | |||
} else { | |||
// set "." as remote | |||
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, | |||
name, ConfigConstants.CONFIG_KEY_MERGE, baseBranch); | |||
} | |||
@@ -298,7 +298,7 @@ public class CreateBranchCommand extends GitCommand<Ref> { | |||
if (name == null | |||
|| !Repository.isValidRefName(Constants.R_HEADS + name)) | |||
throw new InvalidRefNameException(MessageFormat.format(JGitText | |||
.get().branchNameInvalid, name == null ? "<null>" : name)); | |||
.get().branchNameInvalid, name == null ? "<null>" : name)); //$NON-NLS-1$ | |||
} | |||
/** |
@@ -138,7 +138,7 @@ public class DeleteBranchCommand extends GitCommand<List<String>> { | |||
JGitText.get().cannotDeleteCheckedOutBranch, | |||
branchName)); | |||
RefUpdate update = repo.updateRef(fullName); | |||
update.setRefLogMessage("branch deleted", false); | |||
update.setRefLogMessage("branch deleted", false); //$NON-NLS-1$ | |||
update.setForceUpdate(true); | |||
Result deleteResult = update.delete(); | |||
@@ -120,7 +120,7 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> { | |||
try { | |||
if (cached) { | |||
if (oldTree == null) { | |||
ObjectId head = repo.resolve(HEAD + "^{tree}"); | |||
ObjectId head = repo.resolve(HEAD + "^{tree}"); //$NON-NLS-1$ | |||
if (head == null) | |||
throw new NoHeadException(JGitText.get().cannotReadTree); | |||
CanonicalTreeParser p = new CanonicalTreeParser(); |
@@ -80,7 +80,7 @@ public class InitCommand implements Callable<Git> { | |||
d = new File(d, Constants.DOT_GIT); | |||
builder.setGitDir(d); | |||
} else if (builder.getGitDir() == null) { | |||
File d = new File("."); | |||
File d = new File("."); //$NON-NLS-1$ | |||
if (d.getParentFile() != null) | |||
d = d.getParentFile(); | |||
if (!bare) |
@@ -161,9 +161,9 @@ public class LsRemoteCommand extends | |||
Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1); | |||
if (tags) | |||
refSpecs.add(new RefSpec( | |||
"refs/tags/*:refs/remotes/origin/tags/*")); | |||
"refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$ | |||
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; | |||
Map<String, Ref> refmap = new HashMap<String, Ref>(); | |||
fc = transport.openFetch(); |
@@ -151,7 +151,7 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
if (head == null) | |||
throw new NoHeadException( | |||
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); | |||
StringBuilder refLogMessage = new StringBuilder("merge "); | |||
StringBuilder refLogMessage = new StringBuilder("merge "); //$NON-NLS-1$ | |||
// Check for FAST_FORWARD, ALREADY_UP_TO_DATE | |||
revWalk = new RevWalk(repo); | |||
@@ -179,7 +179,7 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
.updateRef(head.getTarget().getName()); | |||
refUpdate.setNewObjectId(objectId); | |||
refUpdate.setExpectedOldObjectId(null); | |||
refUpdate.setRefLogMessage("initial pull", false); | |||
refUpdate.setRefLogMessage("initial pull", false); //$NON-NLS-1$ | |||
if (refUpdate.update() != Result.NEW) | |||
throw new NoHeadException( | |||
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); | |||
@@ -200,7 +200,7 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
&& fastForwardMode == FastForwardMode.FF) { | |||
// FAST_FORWARD detected: skip doing a real merge but only | |||
// update HEAD | |||
refLogMessage.append(": " + MergeStatus.FAST_FORWARD); | |||
refLogMessage.append(": " + MergeStatus.FAST_FORWARD); //$NON-NLS-1$ | |||
dco = new DirCacheCheckout(repo, | |||
headCommit.getTree(), repo.lockDirCache(), | |||
srcCommit.getTree()); | |||
@@ -233,7 +233,7 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
new ObjectId[] { headCommit, srcCommit }, | |||
MergeStatus.ABORTED, mergeStrategy, null, null); | |||
} | |||
String mergeMessage = ""; | |||
String mergeMessage = ""; //$NON-NLS-1$ | |||
if (!squash) { | |||
mergeMessage = new MergeMessageFormatter().format( | |||
commits, head); | |||
@@ -254,7 +254,7 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
if (merger instanceof ResolveMerger) { | |||
ResolveMerger resolveMerger = (ResolveMerger) merger; | |||
resolveMerger.setCommitNames(new String[] { | |||
"BASE", "HEAD", ref.getName() }); | |||
"BASE", "HEAD", ref.getName() }); //$NON-NLS-1$ | |||
resolveMerger.setWorkingTreeIterator(new FileTreeIterator(repo)); | |||
noProblems = merger.merge(headCommit, srcCommit); | |||
lowLevelResults = resolveMerger | |||
@@ -263,11 +263,11 @@ public class MergeCommand extends GitCommand<MergeResult> { | |||
unmergedPaths = resolveMerger.getUnmergedPaths(); | |||
} else | |||
noProblems = merger.merge(headCommit, srcCommit); | |||
refLogMessage.append(": Merge made by "); | |||
refLogMessage.append(": Merge made by "); //$NON-NLS-1$ | |||
if (!revWalk.isMergedInto(headCommit, srcCommit)) | |||
refLogMessage.append(mergeStrategy.getName()); | |||
else | |||
refLogMessage.append("recursive"); | |||
refLogMessage.append("recursive"); //$NON-NLS-1$ | |||
refLogMessage.append('.'); | |||
if (noProblems) { | |||
dco = new DirCacheCheckout(repo, |
@@ -324,6 +324,7 @@ public class MergeResult { | |||
return base; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
boolean first = true; |
@@ -76,7 +76,7 @@ import org.eclipse.jgit.transport.FetchResult; | |||
*/ | |||
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; | |||
@@ -218,7 +218,7 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { | |||
JGitText.get().missingConfigurationForKey, missingKey)); | |||
} | |||
final boolean isRemote = !remote.equals("."); | |||
final boolean isRemote = !remote.equals("."); //$NON-NLS-1$ | |||
String remoteUri; | |||
FetchResult fetchRes; | |||
if (isRemote) { |
@@ -112,6 +112,7 @@ public class PullResult { | |||
return true; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
StringBuilder sb = new StringBuilder(); |
@@ -110,40 +110,40 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
/** | |||
* 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 | |||
*/ | |||
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 | |||
@@ -275,9 +275,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
for (Step step : steps) { | |||
sb.setLength(0); | |||
sb.append(step.action.token); | |||
sb.append(" "); | |||
sb.append(" "); //$NON-NLS-1$ | |||
sb.append(step.commit.name()); | |||
sb.append(" "); | |||
sb.append(" "); //$NON-NLS-1$ | |||
sb.append(RawParseUtils.decode(step.shortMessage) | |||
.trim()); | |||
fw.write(sb.toString()); | |||
@@ -398,7 +398,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
} | |||
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) | |||
throw new NoHeadException( | |||
JGitText.get().cannotRebaseWithoutCurrentHead); | |||
@@ -442,7 +442,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
treeWalk.reset(); | |||
treeWalk.setRecursive(true); | |||
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) | |||
throw new NoHeadException( | |||
JGitText.get().cannotRebaseWithoutCurrentHead); | |||
@@ -496,23 +496,23 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
String toAuthorScript(PersonIdent author) { | |||
StringBuilder sb = new StringBuilder(100); | |||
sb.append(GIT_AUTHOR_NAME); | |||
sb.append("='"); | |||
sb.append("='"); //$NON-NLS-1$ | |||
sb.append(author.getName()); | |||
sb.append("'\n"); | |||
sb.append("'\n"); //$NON-NLS-1$ | |||
sb.append(GIT_AUTHOR_EMAIL); | |||
sb.append("='"); | |||
sb.append("='"); //$NON-NLS-1$ | |||
sb.append(author.getEmailAddress()); | |||
sb.append("'\n"); | |||
sb.append("'\n"); //$NON-NLS-1$ | |||
// the command line uses the "external String" | |||
// representation for date and timezone | |||
sb.append(GIT_AUTHOR_DATE); | |||
sb.append("='"); | |||
sb.append("@"); // @ for time in seconds since 1970 | |||
sb.append("='"); //$NON-NLS-1$ | |||
sb.append("@"); // @ for time in seconds since 1970 //$NON-NLS-1$ | |||
String externalString = author.toExternalString(); | |||
sb | |||
.append(externalString.substring(externalString | |||
.lastIndexOf('>') + 2)); | |||
sb.append("'\n"); | |||
sb.append("'\n"); //$NON-NLS-1$ | |||
return sb.toString(); | |||
} | |||
@@ -655,7 +655,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
createFile(rebaseDir, HEAD_NAME, headName); | |||
createFile(rebaseDir, ONTO, upstreamCommit.name()); | |||
createFile(rebaseDir, ONTO_NAME, upstreamCommitName); | |||
createFile(rebaseDir, INTERACTIVE, ""); | |||
createFile(rebaseDir, INTERACTIVE, ""); //$NON-NLS-1$ | |||
BufferedWriter fw = new BufferedWriter(new OutputStreamWriter( | |||
new FileOutputStream(new File(rebaseDir, GIT_REBASE_TODO)), | |||
Constants.CHARACTER_ENCODING)); | |||
@@ -668,9 +668,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
for (RevCommit commit : cherryPickList) { | |||
sb.setLength(0); | |||
sb.append(Action.PICK.toToken()); | |||
sb.append(" "); | |||
sb.append(" "); //$NON-NLS-1$ | |||
sb.append(reader.abbreviate(commit).name()); | |||
sb.append(" "); | |||
sb.append(" "); //$NON-NLS-1$ | |||
sb.append(commit.getShortMessage()); | |||
fw.write(sb.toString()); | |||
fw.newLine(); | |||
@@ -747,8 +747,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
RefUpdate rup = repo.updateRef(headName); | |||
rup.setExpectedOldObjectId(oldCommit); | |||
rup.setNewObjectId(newCommit); | |||
rup.setRefLogMessage("Fast-foward from " + oldCommit.name() | |||
+ " to " + newCommit.name(), false); | |||
rup.setRefLogMessage("Fast-foward from " + oldCommit.name() //$NON-NLS-1$ | |||
+ " to " + newCommit.name(), false); //$NON-NLS-1$ | |||
Result res = rup.update(walk); | |||
switch (res) { | |||
case FAST_FORWARD: | |||
@@ -756,7 +756,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
case FORCED: | |||
break; | |||
default: | |||
throw new IOException("Could not fast-forward"); | |||
throw new IOException("Could not fast-forward"); //$NON-NLS-1$ | |||
} | |||
} | |||
return newCommit; | |||
@@ -1082,11 +1082,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
*/ | |||
public static enum Action { | |||
/** Use commit */ | |||
PICK("pick", "p"), | |||
PICK("pick", "p"), //$NON-NLS-1$ //$NON-NLS-2$ | |||
/** 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 */ | |||
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; | |||
@@ -1104,6 +1104,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
return this.token; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
return "Action[" + token + "]"; | |||
@@ -1165,9 +1166,12 @@ public class RebaseCommand extends GitCommand<RebaseResult> { | |||
return shortMessage; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
return "Step[" + action + ", " | |||
return "Step[" | |||
+ action | |||
+ ", " | |||
+ ((commit == null) ? "null" : commit) | |||
+ ", " | |||
+ ((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> | |||
int timeStart = 0; | |||
if (time.startsWith("@")) | |||
if (time.startsWith("@")) //$NON-NLS-1$ | |||
timeStart = 1; | |||
else | |||
timeStart = 0; |
@@ -101,7 +101,7 @@ public class RenameBranchCommand extends GitCommand<Ref> { | |||
if (newName == null) | |||
throw new InvalidRefNameException(MessageFormat.format(JGitText | |||
.get().branchNameInvalid, "<null>")); | |||
.get().branchNameInvalid, "<null>")); //$NON-NLS-1$ | |||
try { | |||
String fullOldName; |
@@ -153,7 +153,7 @@ public class ResetCommand extends GitCommand<Ref> { | |||
// resolve the ref to a commit | |||
final ObjectId commitId; | |||
try { | |||
commitId = repo.resolve(ref + "^{commit}"); | |||
commitId = repo.resolve(ref + "^{commit}"); //$NON-NLS-1$ | |||
if (commitId == null) { | |||
// @TODO throw an InvalidRefNameException. We can't do that | |||
// now because this would break the API | |||
@@ -253,7 +253,7 @@ public class ResetCommand extends GitCommand<Ref> { | |||
if (!filepaths.isEmpty()) | |||
throw new JGitInternalException(MessageFormat.format( | |||
JGitText.get().illegalCombinationOfArguments, | |||
"[--mixed | --soft | --hard]", "<paths>...")); | |||
"[--mixed | --soft | --hard]", "<paths>...")); //$NON-NLS-1$ | |||
this.mode = mode; | |||
return this; | |||
} | |||
@@ -267,7 +267,7 @@ public class ResetCommand extends GitCommand<Ref> { | |||
if (mode != null) | |||
throw new JGitInternalException(MessageFormat.format( | |||
JGitText.get().illegalCombinationOfArguments, "<paths>...", | |||
"[--mixed | --soft | --hard]")); | |||
"[--mixed | --soft | --hard]")); //$NON-NLS-1$ | |||
filepaths.add(file); | |||
return this; | |||
} |
@@ -164,13 +164,13 @@ public class RevertCommand extends GitCommand<RevCommit> { | |||
merger.getResultTreeId()); | |||
dco.setFailOnConflict(true); | |||
dco.checkout(); | |||
String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; | |||
String newMessage = shortMessage + "\n\n" | |||
+ "This reverts commit " | |||
+ srcCommit.getId().getName() + ".\n"; | |||
String shortMessage = "Revert \"" + srcCommit.getShortMessage() + "\""; //$NON-NLS-2$ | |||
String newMessage = shortMessage + "\n\n" //$NON-NLS-1$ | |||
+ "This reverts commit " //$NON-NLS-1$ | |||
+ srcCommit.getId().getName() + ".\n"; //$NON-NLS-1$ | |||
newHead = new Git(getRepository()).commit() | |||
.setMessage(newMessage) | |||
.setReflogComment("revert: " + shortMessage).call(); | |||
.setReflogComment("revert: " + shortMessage).call(); //$NON-NLS-1$ | |||
revertedRefs.add(src); | |||
} else { | |||
unmergedPaths = merger.getUnmergedPaths(); |
@@ -84,7 +84,7 @@ import org.eclipse.jgit.util.FileUtils; | |||
*/ | |||
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 | |||
@@ -115,7 +115,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> { | |||
@Override | |||
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 { | |||
final ObjectId headTree; | |||
try { | |||
headTree = repo.resolve(Constants.HEAD + "^{tree}"); | |||
headTree = repo.resolve(Constants.HEAD + "^{tree}"); //$NON-NLS-1$ | |||
} catch (IOException e) { | |||
throw new JGitInternalException(JGitText.get().cannotReadTree, e); | |||
} |
@@ -120,7 +120,7 @@ public class TagCommand extends GitCommand<Ref> { | |||
// if no id is set, we should attempt to use HEAD | |||
if (id == null) { | |||
ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); | |||
ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$ | |||
if (objectId == null) | |||
throw new NoHeadException( | |||
JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); | |||
@@ -142,7 +142,7 @@ public class TagCommand extends GitCommand<Ref> { | |||
RefUpdate tagRef = repo.updateRef(refName); | |||
tagRef.setNewObjectId(tagId); | |||
tagRef.setForceUpdate(forceUpdate); | |||
tagRef.setRefLogMessage("tagged " + name, false); | |||
tagRef.setRefLogMessage("tagged " + name, false); //$NON-NLS-1$ | |||
Result updateResult = tagRef.update(revWalk); | |||
switch (updateResult) { | |||
case NEW: |
@@ -62,7 +62,7 @@ public class ConcurrentRefUpdateException extends GitAPIException { | |||
*/ | |||
public ConcurrentRefUpdateException(String message, Ref ref, | |||
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); | |||
this.rc = rc; | |||
this.ref = ref; | |||
@@ -75,7 +75,7 @@ public class ConcurrentRefUpdateException extends GitAPIException { | |||
*/ | |||
public ConcurrentRefUpdateException(String message, Ref ref, | |||
RefUpdate.Result rc) { | |||
super((rc == null) ? message : message + ". " | |||
super((rc == null) ? message : message + ". " //$NON-NLS-1$ | |||
+ MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc)); | |||
this.rc = rc; | |||
this.ref = ref; |
@@ -177,7 +177,7 @@ public class BlameGenerator { | |||
revPool = new RevWalk(getRepository()); | |||
revPool.setRetainBody(true); | |||
SEEN = revPool.newFlag("SEEN"); | |||
SEEN = revPool.newFlag("SEEN"); //$NON-NLS-1$ | |||
reader = revPool.getObjectReader(); | |||
treeWalk = new TreeWalk(reader); | |||
treeWalk.setRecursive(true); |
@@ -321,7 +321,7 @@ public class BlameResult { | |||
@Override | |||
public String toString() { | |||
StringBuilder r = new StringBuilder(); | |||
r.append("BlameResult: "); | |||
r.append("BlameResult: "); //$NON-NLS-1$ | |||
r.append(getResultPath()); | |||
return r.toString(); | |||
} |
@@ -275,6 +275,7 @@ class Candidate { | |||
return r; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
StringBuilder r = new StringBuilder(); | |||
@@ -324,7 +325,7 @@ class Candidate { | |||
@Override | |||
public String toString() { | |||
return "Reverse" + super.toString(); | |||
return "Reverse" + super.toString(); //$NON-NLS-1$ | |||
} | |||
} | |||
@@ -380,7 +381,7 @@ class Candidate { | |||
@Override | |||
PersonIdent getAuthor() { | |||
return new PersonIdent(description, ""); | |||
return new PersonIdent(description, ""); //$NON-NLS-1$ | |||
} | |||
} | |||
} |
@@ -78,10 +78,10 @@ public class DiffConfig { | |||
private final int renameLimit; | |||
private DiffConfig(final Config rc) { | |||
noPrefix = rc.getBoolean("diff", "noprefix", false); | |||
renameDetectionType = parseRenameDetectionType(rc.getString("diff", | |||
null, "renames")); | |||
renameLimit = rc.getInt("diff", "renamelimit", 200); | |||
noPrefix = rc.getBoolean("diff", "noprefix", false); //$NON-NLS-1$ //$NON-NLS-2$ | |||
renameDetectionType = parseRenameDetectionType(rc.getString("diff", //$NON-NLS-1$ | |||
null, "renames")); //$NON-NLS-1$ | |||
renameLimit = rc.getInt("diff", "renamelimit", 200); //$NON-NLS-1$ //$NON-NLS-2$ | |||
} | |||
/** @return true if the prefix "a/" and "b/" should be suppressed. */ | |||
@@ -108,16 +108,16 @@ public class DiffConfig { | |||
final String renameString) { | |||
if (renameString == null) | |||
return RenameDetectionType.FALSE; | |||
else if (StringUtils.equalsIgnoreCase("copy", renameString) | |||
|| StringUtils.equalsIgnoreCase("copies", renameString)) | |||
else if (StringUtils.equalsIgnoreCase("copy", renameString) //$NON-NLS-1$ | |||
|| StringUtils.equalsIgnoreCase("copies", renameString)) //$NON-NLS-1$ | |||
return RenameDetectionType.COPY; | |||
else { | |||
final Boolean renameBoolean = StringUtils | |||
.toBooleanOrNull(renameString); | |||
if (renameBoolean == null) | |||
throw new IllegalArgumentException(MessageFormat.format( | |||
JGitText.get().enumValueNotSupported2, "diff", | |||
"renames", renameString)); | |||
JGitText.get().enumValueNotSupported2, "diff", //$NON-NLS-1$ | |||
"renames", renameString)); //$NON-NLS-1$ | |||
else if (renameBoolean.booleanValue()) | |||
return RenameDetectionType.TRUE; | |||
else |
@@ -63,7 +63,7 @@ public class DiffEntry { | |||
.fromObjectId(ObjectId.zeroId()); | |||
/** 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. */ | |||
public static enum ChangeType { | |||
@@ -407,6 +407,7 @@ public class DiffEntry { | |||
return side == Side.OLD ? getOldId() : getNewId(); | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
StringBuilder buf = new StringBuilder(); |
@@ -105,7 +105,7 @@ import org.eclipse.jgit.util.io.DisabledOutputStream; | |||
public class DiffFormatter { | |||
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. */ | |||
private static final byte[] EMPTY = new byte[] {}; | |||
@@ -129,9 +129,9 @@ public class DiffFormatter { | |||
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; | |||
@@ -179,8 +179,8 @@ public class DiffFormatter { | |||
DiffConfig dc = db.getConfig().get(DiffConfig.KEY); | |||
if (dc.isNoPrefix()) { | |||
setOldPrefix(""); | |||
setNewPrefix(""); | |||
setOldPrefix(""); //$NON-NLS-1$ | |||
setNewPrefix(""); //$NON-NLS-1$ | |||
} | |||
setDetectRenames(dc.isRenameDetectionEnabled()); | |||
@@ -633,12 +633,12 @@ public class DiffFormatter { | |||
private void writeGitLinkDiffText(OutputStream o, DiffEntry ent) | |||
throws IOException { | |||
if (ent.getOldMode() == GITLINK) { | |||
o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() | |||
+ "\n")); | |||
o.write(encodeASCII("-Subproject commit " + ent.getOldId().name() //$NON-NLS-1$ | |||
+ "\n")); //$NON-NLS-1$ | |||
} | |||
if (ent.getNewMode() == GITLINK) { | |||
o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() | |||
+ "\n")); | |||
o.write(encodeASCII("+Subproject commit " + ent.getNewId().name() //$NON-NLS-1$ | |||
+ "\n")); //$NON-NLS-1$ | |||
} | |||
} | |||
@@ -918,7 +918,7 @@ public class DiffFormatter { | |||
if (aRaw == BINARY || bRaw == BINARY // | |||
|| RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { | |||
formatOldNewPaths(buf, ent); | |||
buf.write(encodeASCII("Binary files differ\n")); | |||
buf.write(encodeASCII("Binary files differ\n")); //$NON-NLS-1$ | |||
editList = new EditList(); | |||
type = PatchType.BINARY; | |||
@@ -1016,7 +1016,7 @@ public class DiffFormatter { | |||
final FileMode oldMode = ent.getOldMode(); | |||
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(' '); | |||
o.write(encode(quotePath(newPrefix + (type == DELETE ? oldp : newp)))); | |||
@@ -1024,40 +1024,40 @@ public class DiffFormatter { | |||
switch (type) { | |||
case ADD: | |||
o.write(encodeASCII("new file mode ")); | |||
o.write(encodeASCII("new file mode ")); //$NON-NLS-1$ | |||
newMode.copyTo(o); | |||
o.write('\n'); | |||
break; | |||
case DELETE: | |||
o.write(encodeASCII("deleted file mode ")); | |||
o.write(encodeASCII("deleted file mode ")); //$NON-NLS-1$ | |||
oldMode.copyTo(o); | |||
o.write('\n'); | |||
break; | |||
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(encode("rename from " + quotePath(oldp))); | |||
o.write(encode("rename from " + quotePath(oldp))); //$NON-NLS-1$ | |||
o.write('\n'); | |||
o.write(encode("rename to " + quotePath(newp))); | |||
o.write(encode("rename to " + quotePath(newp))); //$NON-NLS-1$ | |||
o.write('\n'); | |||
break; | |||
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(encode("copy from " + quotePath(oldp))); | |||
o.write(encode("copy from " + quotePath(oldp))); //$NON-NLS-1$ | |||
o.write('\n'); | |||
o.write(encode("copy to " + quotePath(newp))); | |||
o.write(encode("copy to " + quotePath(newp))); //$NON-NLS-1$ | |||
o.write('\n'); | |||
if (!oldMode.equals(newMode)) { | |||
o.write(encodeASCII("new file mode ")); | |||
o.write(encodeASCII("new file mode ")); //$NON-NLS-1$ | |||
newMode.copyTo(o); | |||
o.write('\n'); | |||
} | |||
@@ -1065,19 +1065,19 @@ public class DiffFormatter { | |||
case MODIFY: | |||
if (0 < ent.getScore()) { | |||
o.write(encodeASCII("dissimilarity index " | |||
+ (100 - ent.getScore()) + "%")); | |||
o.write(encodeASCII("dissimilarity index " //$NON-NLS-1$ | |||
+ (100 - ent.getScore()) + "%")); //$NON-NLS-1$ | |||
o.write('\n'); | |||
} | |||
break; | |||
} | |||
if ((type == MODIFY || type == RENAME) && !oldMode.equals(newMode)) { | |||
o.write(encodeASCII("old mode ")); | |||
o.write(encodeASCII("old mode ")); //$NON-NLS-1$ | |||
oldMode.copyTo(o); | |||
o.write('\n'); | |||
o.write(encodeASCII("new mode ")); | |||
o.write(encodeASCII("new mode ")); //$NON-NLS-1$ | |||
newMode.copyTo(o); | |||
o.write('\n'); | |||
} | |||
@@ -1097,9 +1097,9 @@ public class DiffFormatter { | |||
*/ | |||
protected void formatIndexLine(OutputStream o, DiffEntry ent) | |||
throws IOException { | |||
o.write(encodeASCII("index " // | |||
o.write(encodeASCII("index " // //$NON-NLS-1$ | |||
+ format(ent.getOldId()) // | |||
+ ".." // | |||
+ ".." // //$NON-NLS-1$ | |||
+ format(ent.getNewId()))); | |||
if (ent.getOldMode().equals(ent.getNewMode())) { | |||
o.write(' '); | |||
@@ -1133,8 +1133,8 @@ public class DiffFormatter { | |||
break; | |||
} | |||
o.write(encode("--- " + oldp + "\n")); | |||
o.write(encode("+++ " + newp + "\n")); | |||
o.write(encode("--- " + oldp + "\n")); //$NON-NLS-1$ //$NON-NLS-2$ | |||
o.write(encode("+++ " + newp + "\n")); //$NON-NLS-1$ //$NON-NLS-2$ | |||
} | |||
private int findCombinedEnd(final List<Edit> edits, final int i) { |
@@ -233,6 +233,7 @@ public class Edit { | |||
return false; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
final Type t = getType(); |
@@ -80,6 +80,6 @@ public class EditList extends ArrayList<Edit> { | |||
@Override | |||
public String toString() { | |||
return "EditList" + super.toString(); | |||
return "EditList" + super.toString(); //$NON-NLS-1$ | |||
} | |||
} |
@@ -181,7 +181,7 @@ public class RawText extends Sequence { | |||
*/ | |||
public String getString(int begin, int end, boolean dropLF) { | |||
if (begin == end) | |||
return ""; | |||
return ""; //$NON-NLS-1$ | |||
int s = getStart(begin); | |||
int e = getEnd(end - 1); | |||
@@ -290,8 +290,8 @@ public class RawText extends Sequence { | |||
if (content[e - 1] != '\n') | |||
return null; | |||
if (content.length > 1 && content[e - 2] == '\r') | |||
return "\r\n"; | |||
return "\r\n"; //$NON-NLS-1$ | |||
else | |||
return "\n"; | |||
return "\n"; //$NON-NLS-1$ | |||
} | |||
} |
@@ -320,8 +320,8 @@ class SimilarityRenameDetector { | |||
} | |||
static int nameScore(String a, String b) { | |||
int aDirLen = a.lastIndexOf("/") + 1; | |||
int bDirLen = b.lastIndexOf("/") + 1; | |||
int aDirLen = a.lastIndexOf("/") + 1; //$NON-NLS-1$ | |||
int bDirLen = b.lastIndexOf("/") + 1; //$NON-NLS-1$ | |||
int dirMin = Math.min(aDirLen, bDirLen); | |||
int dirMax = Math.max(aDirLen, bDirLen); |
@@ -555,7 +555,7 @@ public class DirCache { | |||
private static String formatExtensionName(final byte[] hdr) | |||
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) { | |||
@@ -855,8 +855,8 @@ public class DirCache { | |||
System.arraycopy(sortedEntries, 0, r, 0, sortedEntries.length); | |||
return r; | |||
} | |||
if (!path.endsWith("/")) | |||
path += "/"; | |||
if (!path.endsWith("/")) //$NON-NLS-1$ | |||
path += "/"; //$NON-NLS-1$ | |||
final byte[] p = Constants.encode(path); | |||
final int pLen = p.length; | |||
@@ -244,7 +244,7 @@ public class DirCacheBuilder extends BaseDirCacheEditor { | |||
private static IllegalStateException bad(final DirCacheEntry a, | |||
final String msg) { | |||
return new IllegalStateException(msg + ": " + a.getStage() + " " | |||
return new IllegalStateException(msg + ": " + a.getStage() + " " //$NON-NLS-1$ //$NON-NLS-2$ | |||
+ a.getPathString()); | |||
} | |||
} |
@@ -417,7 +417,7 @@ public class DirCacheCheckout { | |||
builder.finish(); | |||
File file = null; | |||
String last = ""; | |||
String last = ""; //$NON-NLS-1$ | |||
// when deleting files process them in the opposite order as they have | |||
// been reported. This ensures the files are deleted before we delete | |||
// their parent folders | |||
@@ -965,7 +965,7 @@ public class DirCacheCheckout { | |||
ObjectLoader ol = or.open(entry.getObjectId()); | |||
File parentDir = f.getParentFile(); | |||
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); | |||
FileOutputStream rawChannel = new FileOutputStream(tmpFile); | |||
OutputStream channel; | |||
@@ -1007,10 +1007,10 @@ public class DirCacheCheckout { | |||
private static byte[][] forbidden; | |||
static { | |||
String[] list = new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", | |||
"COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", "LPT2", | |||
"LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", | |||
"PRN" }; | |||
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", //$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", //$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" }; //$NON-NLS-1$ | |||
forbidden = new byte[list.length][]; | |||
for (int i = 0; i < list.length; ++i) | |||
forbidden[i] = Constants.encodeASCII(list[i]); |
@@ -637,6 +637,7 @@ public class DirCacheEntry { | |||
/** | |||
* Use for debugging only ! | |||
*/ | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
return getFileMode() + " " + getLength() + " " + getLastModified() |
@@ -77,7 +77,7 @@ public class CheckoutConflictException extends IOException { | |||
private static String buildList(String[] files) { | |||
StringBuilder builder = new StringBuilder(); | |||
for (String f : files) { | |||
builder.append("\n"); | |||
builder.append("\n"); //$NON-NLS-1$ | |||
builder.append(f); | |||
} | |||
return builder.toString(); |
@@ -58,9 +58,9 @@ public class CompoundException extends Exception { | |||
final StringBuilder msg = new StringBuilder(); | |||
msg.append(JGitText.get().failureDueToOneOfTheFollowing); | |||
for (final Throwable c : causes) { | |||
msg.append(" "); | |||
msg.append(" "); //$NON-NLS-1$ | |||
msg.append(c.getMessage()); | |||
msg.append("\n"); | |||
msg.append("\n"); //$NON-NLS-1$ | |||
} | |||
return msg.toString(); | |||
} |
@@ -69,11 +69,11 @@ public class InvalidObjectIdException extends IllegalArgumentException { | |||
private static String asAscii(byte[] bytes, int offset, int length) { | |||
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) { | |||
return ""; | |||
return ""; //$NON-NLS-1$ | |||
} catch (StringIndexOutOfBoundsException e2) { | |||
return ""; | |||
return ""; //$NON-NLS-1$ | |||
} | |||
} | |||
} |
@@ -60,10 +60,10 @@ public class MissingBundlePrerequisiteException extends TransportException { | |||
final StringBuilder r = new StringBuilder(); | |||
r.append(JGitText.get().missingPrerequisiteCommits); | |||
for (final Map.Entry<ObjectId, String> e : missingCommits.entrySet()) { | |||
r.append("\n "); | |||
r.append("\n "); //$NON-NLS-1$ | |||
r.append(e.getKey().name()); | |||
if (e.getValue() != null) | |||
r.append(" ").append(e.getValue()); | |||
r.append(" ").append(e.getValue()); //$NON-NLS-1$ | |||
} | |||
return r.toString(); | |||
} |
@@ -63,7 +63,7 @@ public class PackProtocolException extends TransportException { | |||
* message | |||
*/ | |||
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, | |||
final Throwable cause) { | |||
this(uri + ": " + s, cause); | |||
this(uri + ": " + s, cause); //$NON-NLS-1$ | |||
} | |||
/** |
@@ -79,6 +79,6 @@ public class RevisionSyntaxException extends IllegalArgumentException { | |||
@Override | |||
public String toString() { | |||
return super.toString() + ":" + revstr; | |||
return super.toString() + ":" + revstr; //$NON-NLS-1$ | |||
} | |||
} |
@@ -65,8 +65,8 @@ public class TranslationBundleLoadingException extends TranslationBundleExceptio | |||
* {@link ResourceBundle#getBundle(String, Locale)} method. | |||
*/ | |||
public TranslationBundleLoadingException(Class bundleClass, Locale locale, Exception cause) { | |||
super("Loading of translation bundle failed for [" | |||
+ bundleClass.getName() + ", " + locale.toString() + "]", | |||
super("Loading of translation bundle failed for [" //$NON-NLS-1$ | |||
+ bundleClass.getName() + ", " + locale.toString() + "]", //$NON-NLS-1$ //$NON-NLS-2$ | |||
bundleClass, locale, cause); | |||
} | |||
} |
@@ -69,8 +69,8 @@ public class TranslationStringMissingException extends TranslationBundleExceptio | |||
* {@link ResourceBundle#getString(String)} method. | |||
*/ | |||
public TranslationStringMissingException(Class bundleClass, Locale locale, String key, Exception cause) { | |||
super("Translation missing for [" + bundleClass.getName() + ", " | |||
+ locale.toString() + ", " + key + "]", bundleClass, locale, | |||
super("Translation missing for [" + bundleClass.getName() + ", " //$NON-NLS-1$ //$NON-NLS-2$ | |||
+ locale.toString() + ", " + key + "]", bundleClass, locale, //$NON-NLS-1$ //$NON-NLS-2$ | |||
cause); | |||
this.key = key; | |||
} |
@@ -65,7 +65,7 @@ public class TransportException extends IOException { | |||
* message | |||
*/ | |||
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, | |||
final Throwable cause) { | |||
this(uri.setPass(null) + ": " + s, cause); | |||
this(uri.setPass(null) + ": " + s, cause); //$NON-NLS-1$ | |||
} | |||
/** |
@@ -64,6 +64,6 @@ public class UnsupportedCredentialItem extends RuntimeException { | |||
* message | |||
*/ | |||
public UnsupportedCredentialItem(final URIish uri, final String s) { | |||
super(uri.setPass(null) + ": " + s); | |||
super(uri.setPass(null) + ": " + s); //$NON-NLS-1$ | |||
} | |||
} |
@@ -64,6 +64,7 @@ public class ListenerHandle { | |||
parent.remove(this); | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
return type.getSimpleName() + "[" + listener + "]"; |
@@ -85,6 +85,7 @@ public abstract class RepositoryEvent<T extends RepositoryListener> { | |||
*/ | |||
public abstract void dispatch(T listener); | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
String type = getClass().getSimpleName(); |
@@ -86,7 +86,7 @@ public class FileNameMatcher { | |||
static final List<Head> EMPTY_HEAD_LIST = Collections.emptyList(); | |||
private static final Pattern characterClassStartPattern = Pattern | |||
.compile("\\[[.:=]"); | |||
.compile("\\[[.:=]"); //$NON-NLS-1$ | |||
private List<Head> headsStartValue; | |||
@@ -185,7 +185,7 @@ public class FileNameMatcher { | |||
int firstValidEndBracketIndex = indexOfStartBracket + 2; | |||
if (indexOfStartBracket + 1 >= pattern.length()) | |||
throw new NoClosingBracketException(indexOfStartBracket, "[", "]", | |||
throw new NoClosingBracketException(indexOfStartBracket, "[", "]", //$NON-NLS-1$ //$NON-NLS-2$ | |||
pattern); | |||
if (pattern.charAt(firstValidCharClassIndex) == '!') { | |||
@@ -202,8 +202,8 @@ public class FileNameMatcher { | |||
final int possibleGroupEnd = pattern.indexOf(']', | |||
firstValidEndBracketIndex); | |||
if (possibleGroupEnd == -1) | |||
throw new NoClosingBracketException(indexOfStartBracket, "[", | |||
"]", pattern); | |||
throw new NoClosingBracketException(indexOfStartBracket, "[", //$NON-NLS-1$ | |||
"]", pattern); //$NON-NLS-1$ | |||
final boolean foundCharClass = charClassStartMatcher | |||
.find(firstValidCharClassIndex); | |||
@@ -212,7 +212,7 @@ public class FileNameMatcher { | |||
&& charClassStartMatcher.start() < possibleGroupEnd) { | |||
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 classEndIndex = pattern.indexOf(classEnd, |
@@ -57,7 +57,7 @@ final class GroupHead extends AbstractHead { | |||
private final List<CharacterPattern> characterClasses; | |||
private static final Pattern REGEX_PATTERN = Pattern | |||
.compile("([^-][-][^-]|\\[[.:=].*?[.:=]\\])"); | |||
.compile("([^-][-][^-]|\\[[.:=].*?[.:=]\\])"); //$NON-NLS-1$ | |||
private final boolean inverse; | |||
@@ -65,7 +65,7 @@ final class GroupHead extends AbstractHead { | |||
throws InvalidPatternException { | |||
super(false); | |||
this.characterClasses = new ArrayList<CharacterPattern>(); | |||
this.inverse = pattern.startsWith("!"); | |||
this.inverse = pattern.startsWith("!"); //$NON-NLS-1$ | |||
if (inverse) { | |||
pattern = pattern.substring(1); | |||
} | |||
@@ -76,40 +76,40 @@ final class GroupHead extends AbstractHead { | |||
final char start = characterClass.charAt(0); | |||
final char end = characterClass.charAt(2); | |||
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(DigitPattern.INSTANCE); | |||
} else if (characterClass.equals("[:alpha:]")) { | |||
} else if (characterClass.equals("[:alpha:]")) { //$NON-NLS-1$ | |||
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('\t')); | |||
} else if (characterClass.equals("[:cntrl:]")) { | |||
} else if (characterClass.equals("[:cntrl:]")) { //$NON-NLS-1$ | |||
characterClasses.add(new CharacterRange('\u0000', '\u001F')); | |||
characterClasses.add(new OneCharacterPattern('\u007F')); | |||
} else if (characterClass.equals("[:digit:]")) { | |||
} else if (characterClass.equals("[:digit:]")) { //$NON-NLS-1$ | |||
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(LetterPattern.INSTANCE); | |||
characterClasses.add(DigitPattern.INSTANCE); | |||
} else if (characterClass.equals("[:lower:]")) { | |||
} else if (characterClass.equals("[:lower:]")) { //$NON-NLS-1$ | |||
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(LetterPattern.INSTANCE); | |||
characterClasses.add(DigitPattern.INSTANCE); | |||
} else if (characterClass.equals("[:punct:]")) { | |||
} else if (characterClass.equals("[:punct:]")) { //$NON-NLS-1$ | |||
characterClasses.add(PunctPattern.INSTANCE); | |||
} else if (characterClass.equals("[:space:]")) { | |||
} else if (characterClass.equals("[:space:]")) { //$NON-NLS-1$ | |||
characterClasses.add(WhitespacePattern.INSTANCE); | |||
} else if (characterClass.equals("[:upper:]")) { | |||
} else if (characterClass.equals("[:upper:]")) { //$NON-NLS-1$ | |||
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('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(LetterPattern.INSTANCE); | |||
characterClasses.add(DigitPattern.INSTANCE); | |||
@@ -120,7 +120,7 @@ final class GroupHead extends AbstractHead { | |||
throw new InvalidPatternException(message, wholePattern); | |||
} | |||
pattern = matcher.replaceFirst(""); | |||
pattern = matcher.replaceFirst(""); //$NON-NLS-1$ | |||
matcher.reset(pattern); | |||
} | |||
// pattern contains now no ranges | |||
@@ -219,7 +219,7 @@ final class GroupHead extends AbstractHead { | |||
private static final class PunctPattern implements CharacterPattern { | |||
static final GroupHead.PunctPattern INSTANCE = new PunctPattern(); | |||
private static String punctCharacters = "-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; | |||
private static String punctCharacters = "-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; //$NON-NLS-1$ | |||
public boolean matches(char c) { | |||
return punctCharacters.indexOf(c) != -1; |
@@ -102,7 +102,7 @@ public class IgnoreNode { | |||
String txt; | |||
while ((txt = br.readLine()) != null) { | |||
txt = txt.trim(); | |||
if (txt.length() > 0 && !txt.startsWith("#")) | |||
if (txt.length() > 0 && !txt.startsWith("#")) //$NON-NLS-1$ | |||
rules.add(new IgnoreRule(txt)); | |||
} | |||
} |
@@ -82,28 +82,28 @@ public class IgnoreRule { | |||
private void setup() { | |||
int startIndex = 0; | |||
int endIndex = pattern.length(); | |||
if (pattern.startsWith("!")) { | |||
if (pattern.startsWith("!")) { //$NON-NLS-1$ | |||
startIndex++; | |||
negation = true; | |||
} | |||
if (pattern.endsWith("/")) { | |||
if (pattern.endsWith("/")) { //$NON-NLS-1$ | |||
endIndex --; | |||
dirOnly = true; | |||
} | |||
pattern = pattern.substring(startIndex, endIndex); | |||
boolean hasSlash = pattern.contains("/"); | |||
boolean hasSlash = pattern.contains("/"); //$NON-NLS-1$ | |||
if (!hasSlash) | |||
nameOnly = true; | |||
else if (!pattern.startsWith("/")) { | |||
else if (!pattern.startsWith("/")) { //$NON-NLS-1$ | |||
//Contains "/" but does not start with one | |||
//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 { | |||
matcher = new FileNameMatcher(pattern, Character.valueOf('/')); | |||
} catch (InvalidPatternException e) { | |||
@@ -164,8 +164,8 @@ public class IgnoreRule { | |||
* the target is ignored. Call {@link IgnoreRule#getResult() getResult()} for the result. | |||
*/ | |||
public boolean isMatch(String target, boolean isDirectory) { | |||
if (!target.startsWith("/")) | |||
target = "/" + target; | |||
if (!target.startsWith("/")) //$NON-NLS-1$ | |||
target = "/" + target; //$NON-NLS-1$ | |||
if (matcher == null) { | |||
if (target.equals(pattern)) { | |||
@@ -183,12 +183,12 @@ public class IgnoreRule { | |||
* "/src/new" to /src/newfile" but allows "/src/new" to match | |||
* "/src/new/newfile", as is the git standard | |||
*/ | |||
if ((target).startsWith(pattern + "/")) | |||
if ((target).startsWith(pattern + "/")) //$NON-NLS-1$ | |||
return true; | |||
if (nameOnly) { | |||
//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++) { | |||
final String segmentName = segments[idx]; | |||
if (segmentName.equals(pattern) && | |||
@@ -202,7 +202,7 @@ public class IgnoreRule { | |||
if (matcher.isMatch()) | |||
return true; | |||
final String[] segments = target.split("/"); | |||
final String[] segments = target.split("/"); //$NON-NLS-1$ | |||
if (nameOnly) { | |||
for (int idx = 0; idx < segments.length; idx++) { | |||
final String segmentName = segments[idx]; | |||
@@ -220,7 +220,7 @@ public class IgnoreRule { | |||
for (int idx = 0; idx < segments.length; idx++) { | |||
final String segmentName = segments[idx]; | |||
if (segmentName.length() > 0) { | |||
matcher.append("/" + segmentName); | |||
matcher.append("/" + segmentName); //$NON-NLS-1$ | |||
} | |||
if (matcher.isMatch() && |
@@ -375,8 +375,9 @@ public final class AbbreviatedObjectId implements Serializable { | |||
return new String(b, 0, nibbles); | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
return "AbbreviatedObjectId[" + name() + "]"; | |||
return "AbbreviatedObjectId[" + name() + "]"; //$NON-NLS-1$ | |||
} | |||
} |
@@ -489,6 +489,7 @@ public abstract class AnyObjectId implements Comparable<Object> { | |||
dst[o--] = '0'; | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
return "AnyObjectId[" + name() + "]"; |
@@ -487,7 +487,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re | |||
*/ | |||
public B findGitDir() { | |||
if (getGitDir() == null) | |||
findGitDir(new File("").getAbsoluteFile()); | |||
findGitDir(new File("").getAbsoluteFile()); //$NON-NLS-1$ | |||
return self(); | |||
} | |||
@@ -628,7 +628,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re | |||
if (getGitDir() == null) | |||
setGitDir(getWorkTree().getParentFile()); | |||
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 { | |||
if (getObjectDirectory() == null && getGitDir() != null) | |||
setObjectDirectory(safeFS().resolve(getGitDir(), "objects")); | |||
setObjectDirectory(safeFS().resolve(getGitDir(), "objects")); //$NON-NLS-1$ | |||
} | |||
/** |
@@ -168,7 +168,7 @@ public class BatchRefUpdate { | |||
if (msg == null && !appendStatus) | |||
disableRefLog(); | |||
else if (msg == null && appendStatus) { | |||
refLogMessage = ""; | |||
refLogMessage = ""; //$NON-NLS-1$ | |||
refLogIncludeResult = true; | |||
} else { | |||
refLogMessage = msg; |
@@ -69,7 +69,7 @@ public abstract class BatchingProgressMonitor implements ProgressMonitor { | |||
public Thread newThread(Runnable taskBody) { | |||
Thread thr = baseFactory.newThread(taskBody); | |||
thr.setName("JGit-AlarmQueue"); | |||
thr.setName("JGit-AlarmQueue"); //$NON-NLS-1$ | |||
thr.setDaemon(true); | |||
return thr; | |||
} |
@@ -81,7 +81,7 @@ public class BranchConfig { | |||
if (remote == null || mergeRef == null) | |||
return null; | |||
if (remote.equals(".")) | |||
if (remote.equals(".")) //$NON-NLS-1$ | |||
return mergeRef; | |||
return findRemoteTrackingBranch(remote, mergeRef); |
@@ -66,15 +66,15 @@ import java.util.List; | |||
public class CommitBuilder { | |||
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; | |||
@@ -322,6 +322,7 @@ public class CommitBuilder { | |||
return build(); | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
StringBuilder r = new StringBuilder(); |
@@ -134,24 +134,24 @@ public class Config { | |||
r.append('"'); | |||
inquote = false; | |||
} | |||
r.append("\\n\\\n"); | |||
r.append("\\n\\\n"); //$NON-NLS-1$ | |||
lineStart = r.length(); | |||
break; | |||
case '\t': | |||
r.append("\\t"); | |||
r.append("\\t"); //$NON-NLS-1$ | |||
break; | |||
case '\b': | |||
r.append("\\b"); | |||
r.append("\\b"); //$NON-NLS-1$ | |||
break; | |||
case '\\': | |||
r.append("\\\\"); | |||
r.append("\\\\"); //$NON-NLS-1$ | |||
break; | |||
case '"': | |||
r.append("\\\""); | |||
r.append("\\\""); //$NON-NLS-1$ | |||
break; | |||
case ';': | |||
@@ -354,7 +354,7 @@ public class Config { | |||
@SuppressWarnings("unchecked") | |||
private static <T> T[] allValuesOf(final T value) { | |||
try { | |||
return (T[]) value.getClass().getMethod("values").invoke(null); | |||
return (T[]) value.getClass().getMethod("values").invoke(null); //$NON-NLS-1$ | |||
} catch (Exception err) { | |||
String typeName = value.getClass().getName(); | |||
String msg = MessageFormat.format( | |||
@@ -393,9 +393,9 @@ public class Config { | |||
for (T e : all) { | |||
if (StringUtils.equalsIgnoreCase(e.name(), n)) | |||
return e; | |||
else if (StringUtils.equalsIgnoreCase(e.name(), "TRUE")) | |||
else if (StringUtils.equalsIgnoreCase(e.name(), "TRUE")) //$NON-NLS-1$ | |||
trueState = e; | |||
else if (StringUtils.equalsIgnoreCase(e.name(), "FALSE")) | |||
else if (StringUtils.equalsIgnoreCase(e.name(), "FALSE")) //$NON-NLS-1$ | |||
falseState = e; | |||
} | |||
@@ -664,11 +664,11 @@ public class Config { | |||
final String s; | |||
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) | |||
s = String.valueOf(value / MiB) + " m"; | |||
s = String.valueOf(value / MiB) + " m"; //$NON-NLS-1$ | |||
else if (value >= KiB && (value % KiB) == 0) | |||
s = String.valueOf(value / KiB) + " k"; | |||
s = String.valueOf(value / KiB) + " k"; //$NON-NLS-1$ | |||
else | |||
s = String.valueOf(value); | |||
@@ -695,7 +695,7 @@ public class Config { | |||
*/ | |||
public void setBoolean(final String section, final String subsection, | |||
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(' '); | |||
String escaped = escapeValue(e.subsection); | |||
// make sure to avoid double quotes here | |||
boolean quoted = escaped.startsWith("\"") | |||
&& escaped.endsWith("\""); | |||
boolean quoted = escaped.startsWith("\"") //$NON-NLS-1$ | |||
&& escaped.endsWith("\""); //$NON-NLS-1$ | |||
if (!quoted) | |||
out.append('"'); | |||
out.append(escaped); | |||
@@ -947,11 +947,11 @@ public class Config { | |||
} | |||
out.append(']'); | |||
} 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(e.name); | |||
if (MAGIC_EMPTY_VALUE != e.value) { | |||
out.append(" ="); | |||
out.append(" ="); //$NON-NLS-1$ | |||
if (e.value != null) { | |||
out.append(' '); | |||
out.append(escapeValue(e.value)); | |||
@@ -1005,7 +1005,7 @@ public class Config { | |||
} else if (e.section == null && Character.isWhitespace(c)) { | |||
// Save the leading whitespace (if any). | |||
if (e.prefix == null) | |||
e.prefix = ""; | |||
e.prefix = ""; //$NON-NLS-1$ | |||
e.prefix += c; | |||
} else if ('[' == c) { | |||
@@ -1018,7 +1018,7 @@ public class Config { | |||
} | |||
if (']' != input) | |||
throw new ConfigInvalidException(JGitText.get().badGroupHeader); | |||
e.suffix = ""; | |||
e.suffix = ""; //$NON-NLS-1$ | |||
} else if (last != null) { | |||
// Read a value. | |||
@@ -1026,7 +1026,7 @@ public class Config { | |||
e.subsection = last.subsection; | |||
in.reset(); | |||
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.value = MAGIC_EMPTY_VALUE; | |||
} else |
@@ -47,6 +47,7 @@ package org.eclipse.jgit.lib; | |||
* Constants for use with the Configuration classes: section names, | |||
* configuration keys | |||
*/ | |||
@SuppressWarnings("nls") | |||
public class ConfigConstants { | |||
/** The "core" section */ | |||
public static final String CONFIG_CORE_SECTION = "core"; |
@@ -112,6 +112,7 @@ class ConfigLine { | |||
return a.equals(b); | |||
} | |||
@SuppressWarnings("nls") | |||
@Override | |||
public String toString() { | |||
if (section == null) |