Browse Source

Externalize strings from JGit

The strings are externalized into the root resource bundles.
The resource bundles are stored under the new "resources" source
folder to get proper maven build.

Strings from tests are, in general, not externalized. Only in
cases where it was necessary to make the test pass the strings
were externalized. This was typically necessary in cases where
e.getMessage() was used in assert and the exception message was
slightly changed due to reuse of the externalized strings.

Change-Id: Ic0f29c80b9a54fcec8320d8539a3e112852a1f7b
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
stable-0.8
Sasa Zivkov 15 years ago committed by Shawn O. Pearce
parent
commit
f3d8a8ecad
  1. 1
      org.eclipse.jgit.console/.classpath
  2. 3
      org.eclipse.jgit.console/META-INF/MANIFEST.MF
  3. 3
      org.eclipse.jgit.console/pom.xml
  4. 5
      org.eclipse.jgit.console/resources/org/eclipse/jgit/console/ConsoleText.properties
  5. 7
      org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleAuthenticator.java
  6. 6
      org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java
  7. 66
      org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleText.java
  8. 1
      org.eclipse.jgit.http.server/.classpath
  9. 1
      org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
  10. 3
      org.eclipse.jgit.http.server/pom.xml
  11. 21
      org.eclipse.jgit.http.server/resources/org/eclipse/jgit/http/server/HttpServerText.properties
  12. 5
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java
  13. 11
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java
  14. 82
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/HttpServerText.java
  15. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
  16. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java
  17. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java
  18. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
  19. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java
  20. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java
  21. 8
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
  22. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/ServiceNotAuthorizedException.java
  23. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/ServiceNotEnabledException.java
  24. 1
      org.eclipse.jgit.iplog/.classpath
  25. 1
      org.eclipse.jgit.iplog/META-INF/MANIFEST.MF
  26. 3
      org.eclipse.jgit.iplog/pom.xml
  27. 17
      org.eclipse.jgit.iplog/resources/org/eclipse/jgit/iplog/IpLogText.properties
  28. 3
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CQ.java
  29. 3
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java
  30. 3
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Committer.java
  31. 3
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Contributor.java
  32. 21
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IPZillaQuery.java
  33. 21
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
  34. 5
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java
  35. 78
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogText.java
  36. 3
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Project.java
  37. 3
      org.eclipse.jgit.pgm/.classpath
  38. 13
      org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
  39. 3
      org.eclipse.jgit.pgm/pom.xml
  40. 174
      org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties
  41. 25
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
  42. 19
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
  43. 52
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java
  44. 142
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java
  45. 21
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  46. 13
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
  47. 29
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
  48. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
  49. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
  50. 14
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java
  51. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
  52. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
  53. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
  54. 19
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
  55. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  56. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
  57. 65
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
  58. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
  59. 26
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  60. 7
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
  61. 12
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
  62. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
  63. 19
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
  64. 36
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
  65. 9
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
  66. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
  67. 15
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
  68. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
  69. 45
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  70. 17
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
  71. 11
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
  72. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java
  73. 20
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java
  74. 13
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
  75. 15
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
  76. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
  77. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java
  78. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java
  79. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java
  80. 17
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
  81. 13
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
  82. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java
  83. 6
      org.eclipse.jgit.test/META-INF/MANIFEST.MF
  84. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
  85. 12
      org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java
  86. 10
      org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java
  87. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
  88. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
  89. 1
      org.eclipse.jgit.ui/.classpath
  90. 1
      org.eclipse.jgit.ui/META-INF/MANIFEST.MF
  91. 3
      org.eclipse.jgit.ui/pom.xml
  92. 8
      org.eclipse.jgit.ui/resources/org/eclipse/jgit/awtui/UIText.properties
  93. 9
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtAuthenticator.java
  94. 2
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtSshSessionFactory.java
  95. 6
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
  96. 69
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/UIText.java
  97. 1
      org.eclipse.jgit/.classpath
  98. 3
      org.eclipse.jgit/META-INF/MANIFEST.MF
  99. 3
      org.eclipse.jgit/pom.xml
  100. 360
      org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
  101. Some files were not shown because too many files have changed in this diff Show More

1
org.eclipse.jgit.console/.classpath

@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

3
org.eclipse.jgit.console/META-INF/MANIFEST.MF

@ -7,6 +7,7 @@ Bundle-Version: 0.8.0.qualifier
Bundle-Vendor: %provider_name Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.jgit.console;version="0.8.0" Export-Package: org.eclipse.jgit.console;version="0.8.0"
Import-Package: org.eclipse.jgit.transport;version="[0.8.0,0.9.0)", Import-Package: org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.transport;version="[0.8.0,0.9.0)",
org.eclipse.jgit.util;version="[0.8.0,0.9.0)" org.eclipse.jgit.util;version="[0.8.0,0.9.0)"
Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)" Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)"

3
org.eclipse.jgit.console/pom.xml

@ -84,6 +84,9 @@
<include>plugin.properties</include> <include>plugin.properties</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>resources/</directory>
</resource>
</resources> </resources>
<plugins> <plugins>

5
org.eclipse.jgit.console/resources/org/eclipse/jgit/console/ConsoleText.properties

@ -0,0 +1,5 @@
answerNo=n
answerYes=y
noSystemConsoleAvailable=No System.console available
password=Password:
usernameFor=Username for {0}:

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

@ -47,6 +47,7 @@ package org.eclipse.jgit.console;
import java.io.Console; import java.io.Console;
import java.net.Authenticator; import java.net.Authenticator;
import java.net.PasswordAuthentication; import java.net.PasswordAuthentication;
import java.text.MessageFormat;
import org.eclipse.jgit.util.CachedAuthenticator; import org.eclipse.jgit.util.CachedAuthenticator;
@ -56,7 +57,7 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
public static void install() { public static void install() {
final ConsoleAuthenticator c = new ConsoleAuthenticator(); final ConsoleAuthenticator c = new ConsoleAuthenticator();
if (c.cons == null) if (c.cons == null)
throw new NoClassDefFoundError("No System.console available"); throw new NoClassDefFoundError(ConsoleText.get().noSystemConsoleAvailable);
Authenticator.setDefault(c); Authenticator.setDefault(c);
} }
@ -65,11 +66,11 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
@Override @Override
protected PasswordAuthentication promptPasswordAuthentication() { protected PasswordAuthentication promptPasswordAuthentication() {
final String realm = formatRealm(); final String realm = formatRealm();
String username = cons.readLine("Username for %s: ", realm); String username = cons.readLine(MessageFormat.format(ConsoleText.get().usernameFor + " ", realm));
if (username == null || username.isEmpty()) { if (username == null || username.isEmpty()) {
return null; return null;
} }
char[] password = cons.readPassword("Password: "); char[] password = cons.readPassword(ConsoleText.get().password + " ");
if (password == null) { if (password == null) {
password = new char[0]; password = new char[0];
} }

6
org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleSshSessionFactory.java

@ -70,7 +70,7 @@ public class ConsoleSshSessionFactory extends SshConfigSessionFactory {
public static void install() { public static void install() {
final ConsoleSshSessionFactory c = new ConsoleSshSessionFactory(); final ConsoleSshSessionFactory c = new ConsoleSshSessionFactory();
if (c.cons == null) if (c.cons == null)
throw new NoClassDefFoundError("No System.console available"); throw new NoClassDefFoundError(ConsoleText.get().noSystemConsoleAvailable);
SshSessionFactory.setInstance(c); SshSessionFactory.setInstance(c);
} }
@ -93,8 +93,8 @@ public class ConsoleSshSessionFactory extends SshConfigSessionFactory {
} }
public boolean promptYesNo(final String msg) { public boolean promptYesNo(final String msg) {
String r = cons.readLine("%s [y/n]? ", msg); String r = cons.readLine("%s [%s/%s]? ", msg, ConsoleText.get().answerYes, ConsoleText.get().answerNo);
return "y".equalsIgnoreCase(r); return ConsoleText.get().answerYes.equalsIgnoreCase(r);
} }
public boolean promptPassword(final String msg) { public boolean promptPassword(final String msg) {

66
org.eclipse.jgit.console/src/org/eclipse/jgit/console/ConsoleText.java

@ -0,0 +1,66 @@
/*
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.eclipse.jgit.console;
import org.eclipse.jgit.nls.NLS;
import org.eclipse.jgit.nls.TranslationBundle;
/**
* Translation bundle for JGit console
*/
public class ConsoleText extends TranslationBundle {
/**
* @return an instance of this translation bundle
*/
public static ConsoleText get() {
return NLS.getBundleFor(ConsoleText.class);
}
/***/ public String answerNo;
/***/ public String answerYes;
/***/ public String noSystemConsoleAvailable;
/***/ public String password;
/***/ public String usernameFor;
}

1
org.eclipse.jgit.http.server/.classpath

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

1
org.eclipse.jgit.http.server/META-INF/MANIFEST.MF

@ -15,6 +15,7 @@ Import-Package: javax.servlet;version="[2.5.0,3.0.0)",
javax.servlet.http;version="[2.5.0,3.0.0)", javax.servlet.http;version="[2.5.0,3.0.0)",
org.eclipse.jgit.errors;version="[0.8.0,0.9.0)", org.eclipse.jgit.errors;version="[0.8.0,0.9.0)",
org.eclipse.jgit.lib;version="[0.8.0,0.9.0)", org.eclipse.jgit.lib;version="[0.8.0,0.9.0)",
org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.transport;version="[0.8.0,0.9.0)", org.eclipse.jgit.transport;version="[0.8.0,0.9.0)",
org.eclipse.jgit.util;version="[0.8.0,0.9.0)", org.eclipse.jgit.util;version="[0.8.0,0.9.0)",

3
org.eclipse.jgit.http.server/pom.xml

@ -90,6 +90,9 @@
<include>plugin.properties</include> <include>plugin.properties</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>resources/</directory>
</resource>
</resources> </resources>
<plugins> <plugins>

21
org.eclipse.jgit.http.server/resources/org/eclipse/jgit/http/server/HttpServerText.properties

@ -0,0 +1,21 @@
alreadyInitializedByContainer=Already initialized by container
cannotGetLengthOf=Cannot get length of {0}
encodingNotSupportedByThisLibrary={0} "{1}": not supported by this library.
expectedRepositoryAttribute=Expected Repository attribute
filterMustNotBeNull=filter must not be null
internalErrorDuringReceivePack=Internal error during receive-pack
internalErrorDuringUploadPack=Internal error during upload-pack
internalServerErrorRequestAttributeWasAlreadySet=Internal server error, request attribute {0} was already set when {1} was invoked.
invalidBoolean=Invalid boolean {0} = {1}
invalidIndex=Invalid index: {0}
invalidRegexGroup=Invalid regex group {0}
noResolverAvailable=No resolver available
parameterNotSet=Parameter {0} not set
pathForParamNotFound={0} (for {1}) not found
pathNotSupported={0} not supported
serviceNotEnabled=Service not enabled
serviceNotPermitted=Service not permitted
servletAlreadyInitialized=Servlet already initialized
servletMustNotBeNull=servlet must not be null
servletWasAlreadyBound=servlet was already bound
unexpectedeOFOn=Unexpected EOF on {0}

5
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java

@ -57,6 +57,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.text.MessageFormat;
import java.util.Enumeration; import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -100,7 +101,7 @@ final class FileSender {
} }
final FileNotFoundException r; final FileNotFoundException r;
r = new FileNotFoundException("Cannot get length of " + path); r = new FileNotFoundException(MessageFormat.format(HttpServerText.get().cannotGetLengthOf, path));
r.initCause(e); r.initCause(e);
throw r; throw r;
} }
@ -143,7 +144,7 @@ final class FileSender {
final int r = (int) Math.min(buf.length, end - pos); final int r = (int) Math.min(buf.length, end - pos);
final int n = source.read(buf, 0, r); final int n = source.read(buf, 0, r);
if (n < 0) { if (n < 0) {
throw new EOFException("Unexpected EOF on " + path); throw new EOFException(MessageFormat.format(HttpServerText.get().unexpectedeOFOn, path));
} }
out.write(buf, 0, n); out.write(buf, 0, n);
pos += n; pos += n;

11
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java

@ -44,6 +44,7 @@
package org.eclipse.jgit.http.server; package org.eclipse.jgit.http.server;
import java.io.File; import java.io.File;
import java.text.MessageFormat;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -169,7 +170,7 @@ public class GitServlet extends MetaServlet {
private void assertNotInitialized() { private void assertNotInitialized() {
if (initialized) if (initialized)
throw new IllegalStateException("Already initialized by container"); throw new IllegalStateException(HttpServerText.get().alreadyInitializedByContainer);
} }
@Override @Override
@ -259,11 +260,11 @@ public class GitServlet extends MetaServlet {
private File getFile(final String param) throws ServletException { private File getFile(final String param) throws ServletException {
String n = getInitParameter(param); String n = getInitParameter(param);
if (n == null || "".equals(n)) if (n == null || "".equals(n))
throw new ServletException("Parameter " + param + " not set"); throw new ServletException(MessageFormat.format(HttpServerText.get().parameterNotSet, param));
File path = new File(n); File path = new File(n);
if (!path.exists()) if (!path.exists())
throw new ServletException(path + " (for " + param + ") not found"); throw new ServletException(MessageFormat.format(HttpServerText.get().pathForParamNotFound, path, param));
return path; return path;
} }
@ -274,14 +275,14 @@ public class GitServlet extends MetaServlet {
try { try {
return StringUtils.toBoolean(n); return StringUtils.toBoolean(n);
} catch (IllegalArgumentException err) { } catch (IllegalArgumentException err) {
throw new ServletException("Invalid boolean " + param + " = " + n); throw new ServletException(MessageFormat.format(HttpServerText.get().invalidBoolean, param, n));
} }
} }
@Override @Override
protected ServletBinder register(ServletBinder binder) { protected ServletBinder register(ServletBinder binder) {
if (resolver == null) if (resolver == null)
throw new IllegalStateException("No resolver available"); throw new IllegalStateException(HttpServerText.get().noResolverAvailable);
binder = binder.through(new NoCacheFilter()); binder = binder.through(new NoCacheFilter());
binder = binder.through(new RepositoryFilter(resolver)); binder = binder.through(new RepositoryFilter(resolver));
return binder; return binder;

82
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/HttpServerText.java

@ -0,0 +1,82 @@
/*
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.eclipse.jgit.http.server;
import org.eclipse.jgit.nls.NLS;
import org.eclipse.jgit.nls.TranslationBundle;
/**
* Translation bundle for JGit http server
*/
public class HttpServerText extends TranslationBundle {
/**
* @return an instance of this translation bundle
*/
public static HttpServerText get() {
return NLS.getBundleFor(HttpServerText.class);
}
/***/ public String alreadyInitializedByContainer;
/***/ public String cannotGetLengthOf;
/***/ public String encodingNotSupportedByThisLibrary;
/***/ public String expectedRepositoryAttribute;
/***/ public String filterMustNotBeNull;
/***/ public String internalErrorDuringReceivePack;
/***/ public String internalErrorDuringUploadPack;
/***/ public String internalServerErrorRequestAttributeWasAlreadySet;
/***/ public String invalidBoolean;
/***/ public String invalidIndex;
/***/ public String invalidRegexGroup;
/***/ public String noResolverAvailable;
/***/ public String parameterNotSet;
/***/ public String pathForParamNotFound;
/***/ public String pathNotSupported;
/***/ public String serviceNotEnabled;
/***/ public String serviceNotPermitted;
/***/ public String servletAlreadyInitialized;
/***/ public String servletMustNotBeNull;
/***/ public String servletWasAlreadyBound;
/***/ public String unexpectedeOFOn;
}

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java

@ -120,7 +120,7 @@ class ReceivePackServlet extends HttpServlet {
return; return;
} catch (IOException e) { } catch (IOException e) {
getServletContext().log("Internal error during receive-pack", e); getServletContext().log(HttpServerText.get().internalErrorDuringReceivePack, e);
rsp.sendError(SC_INTERNAL_SERVER_ERROR); rsp.sendError(SC_INTERNAL_SERVER_ERROR);
return; return;
} }

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java

@ -50,6 +50,7 @@ import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
import static org.eclipse.jgit.http.server.ServletUtils.ATTRIBUTE_REPOSITORY; import static org.eclipse.jgit.http.server.ServletUtils.ATTRIBUTE_REPOSITORY;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
@ -109,9 +110,9 @@ public class RepositoryFilter implements Filter {
final ServletResponse rsp, final FilterChain chain) final ServletResponse rsp, final FilterChain chain)
throws IOException, ServletException { throws IOException, ServletException {
if (request.getAttribute(ATTRIBUTE_REPOSITORY) != null) { if (request.getAttribute(ATTRIBUTE_REPOSITORY) != null) {
context.log("Internal server error, request attribute " context.log(MessageFormat.format(HttpServerText.get().internalServerErrorRequestAttributeWasAlreadySet
+ ATTRIBUTE_REPOSITORY + " was already set when " , ATTRIBUTE_REPOSITORY
+ getClass().getName() + " was invoked."); , getClass().getName()));
((HttpServletResponse) rsp).sendError(SC_INTERNAL_SERVER_ERROR); ((HttpServletResponse) rsp).sendError(SC_INTERNAL_SERVER_ERROR);
return; return;
} }

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java

@ -54,6 +54,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.text.MessageFormat;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
@ -85,7 +86,7 @@ public final class ServletUtils {
public static Repository getRepository(final ServletRequest req) { public static Repository getRepository(final ServletRequest req) {
Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY); Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY);
if (db == null) if (db == null)
throw new IllegalStateException("Expected Repository attribute"); throw new IllegalStateException(HttpServerText.get().expectedRepositoryAttribute);
return db; return db;
} }
@ -109,8 +110,8 @@ public final class ServletUtils {
if (ENCODING_GZIP.equals(enc) || "x-gzip".equals(enc)) //$NON-NLS-1$ if (ENCODING_GZIP.equals(enc) || "x-gzip".equals(enc)) //$NON-NLS-1$
in = new GZIPInputStream(in); in = new GZIPInputStream(in);
else if (enc != null) else if (enc != null)
throw new IOException(HDR_CONTENT_ENCODING + " \"" + enc + "\"" throw new IOException(MessageFormat.format(HttpServerText.get().encodingNotSupportedByThisLibrary
+ ": not supported by this library."); , HDR_CONTENT_ENCODING, enc));
return in; return in;
} }

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java

@ -122,7 +122,7 @@ class UploadPackServlet extends HttpServlet {
return; return;
} catch (IOException e) { } catch (IOException e) {
getServletContext().log("Internal error during upload-pack", e); getServletContext().log(HttpServerText.get().internalErrorDuringUploadPack, e);
rsp.reset(); rsp.reset();
rsp.sendError(SC_INTERNAL_SERVER_ERROR); rsp.sendError(SC_INTERNAL_SERVER_ERROR);
return; return;

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java

@ -46,6 +46,7 @@ package org.eclipse.jgit.http.server.glue;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import java.util.AbstractSet; import java.util.AbstractSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
@ -59,6 +60,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jgit.http.server.HttpServerText;
/** /**
* Generic container servlet to manage routing to different pipelines. * Generic container servlet to manage routing to different pipelines.
* <p> * <p>
@ -95,7 +98,7 @@ public class MetaServlet extends HttpServlet {
public ServletBinder serve(String path) { public ServletBinder serve(String path) {
if (path.startsWith("*")) if (path.startsWith("*"))
return register(new SuffixPipeline.Binder(path.substring(1))); return register(new SuffixPipeline.Binder(path.substring(1)));
throw new IllegalArgumentException("\"" + path + "\" not supported"); throw new IllegalArgumentException(MessageFormat.format(HttpServerText.get().pathNotSupported, path));
} }
/** /**
@ -164,7 +167,7 @@ public class MetaServlet extends HttpServlet {
private ServletBinder register(ServletBinderImpl b) { private ServletBinder register(ServletBinderImpl b) {
synchronized (bindings) { synchronized (bindings) {
if (pipelines != null) if (pipelines != null)
throw new IllegalStateException("Servlet already initialized"); throw new IllegalStateException(HttpServerText.get().servletAlreadyInitialized);
bindings.add(b); bindings.add(b);
} }
return register((ServletBinder) b); return register((ServletBinder) b);

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java

@ -44,6 +44,7 @@
package org.eclipse.jgit.http.server.glue; package org.eclipse.jgit.http.server.glue;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
@ -52,6 +53,8 @@ import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import org.eclipse.jgit.http.server.HttpServerText;
/** /**
* Switch servlet path and path info to use another regex match group. * Switch servlet path and path info to use another regex match group.
* <p> * <p>
@ -69,7 +72,7 @@ public class RegexGroupFilter implements Filter {
*/ */
public RegexGroupFilter(final int groupIdx) { public RegexGroupFilter(final int groupIdx) {
if (groupIdx < 1) if (groupIdx < 1)
throw new IllegalArgumentException("Invalid index: " + groupIdx); throw new IllegalArgumentException(MessageFormat.format(HttpServerText.get().invalidIndex, groupIdx));
this.groupIdx = groupIdx - 1; this.groupIdx = groupIdx - 1;
} }
@ -88,7 +91,7 @@ public class RegexGroupFilter implements Filter {
if (groupIdx < g.length) if (groupIdx < g.length)
chain.doFilter(g[groupIdx], rsp); chain.doFilter(g[groupIdx], rsp);
else else
throw new ServletException("Invalid regex group " + (groupIdx + 1)); throw new ServletException(MessageFormat.format(HttpServerText.get().invalidRegexGroup, (groupIdx + 1)));
} }
private static WrappedRequest[] groupsFor(final ServletRequest r) { private static WrappedRequest[] groupsFor(final ServletRequest r) {

8
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java

@ -50,6 +50,8 @@ import javax.servlet.Filter;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jgit.http.server.HttpServerText;
abstract class ServletBinderImpl implements ServletBinder { abstract class ServletBinderImpl implements ServletBinder {
private final List<Filter> filters; private final List<Filter> filters;
@ -61,16 +63,16 @@ abstract class ServletBinderImpl implements ServletBinder {
public ServletBinder through(Filter filter) { public ServletBinder through(Filter filter) {
if (filter == null) if (filter == null)
throw new NullPointerException("filter must not be null"); throw new NullPointerException(HttpServerText.get().filterMustNotBeNull);
filters.add(filter); filters.add(filter);
return this; return this;
} }
public void with(HttpServlet servlet) { public void with(HttpServlet servlet) {
if (servlet == null) if (servlet == null)
throw new NullPointerException("servlet must not be null"); throw new NullPointerException(HttpServerText.get().servletMustNotBeNull);
if (httpServlet != null) if (httpServlet != null)
throw new IllegalStateException("servlet was already bound"); throw new IllegalStateException(HttpServerText.get().servletWasAlreadyBound);
httpServlet = servlet; httpServlet = servlet;
} }

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/ServiceNotAuthorizedException.java

@ -43,12 +43,14 @@
package org.eclipse.jgit.http.server.resolver; package org.eclipse.jgit.http.server.resolver;
import org.eclipse.jgit.http.server.HttpServerText;
/** Indicates the request service is not authorized for current user. */ /** Indicates the request service is not authorized for current user. */
public class ServiceNotAuthorizedException extends Exception { public class ServiceNotAuthorizedException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** Indicates the request service is not available. */ /** Indicates the request service is not available. */
public ServiceNotAuthorizedException() { public ServiceNotAuthorizedException() {
super("Service not permitted"); super(HttpServerText.get().serviceNotPermitted);
} }
} }

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/ServiceNotEnabledException.java

@ -43,12 +43,14 @@
package org.eclipse.jgit.http.server.resolver; package org.eclipse.jgit.http.server.resolver;
import org.eclipse.jgit.http.server.HttpServerText;
/** Indicates the request service is not enabled on a repository. */ /** Indicates the request service is not enabled on a repository. */
public class ServiceNotEnabledException extends Exception { public class ServiceNotEnabledException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** Indicates the request service is not available. */ /** Indicates the request service is not available. */
public ServiceNotEnabledException() { public ServiceNotEnabledException() {
super("Service not enabled"); super(HttpServerText.get().serviceNotEnabled);
} }
} }

1
org.eclipse.jgit.iplog/.classpath

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

1
org.eclipse.jgit.iplog/META-INF/MANIFEST.MF

@ -11,6 +11,7 @@ Import-Package: org.eclipse.jgit.diff;version="[0.8.0,0.9.0)",
org.eclipse.jgit.dircache;version="[0.8.0,0.9.0)", org.eclipse.jgit.dircache;version="[0.8.0,0.9.0)",
org.eclipse.jgit.errors;version="[0.8.0,0.9.0)", org.eclipse.jgit.errors;version="[0.8.0,0.9.0)",
org.eclipse.jgit.lib;version="[0.8.0,0.9.0)", org.eclipse.jgit.lib;version="[0.8.0,0.9.0)",
org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)", org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk.filter;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk.filter;version="[0.8.0,0.9.0)",

3
org.eclipse.jgit.iplog/pom.xml

@ -83,6 +83,9 @@
<include>plugin.properties</include> <include>plugin.properties</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>resources/</directory>
</resource>
</resources> </resources>
<plugins> <plugins>

17
org.eclipse.jgit.iplog/resources/org/eclipse/jgit/iplog/IpLogText.properties

@ -0,0 +1,17 @@
CQString=CQ {0}
CSVParsingError=CSV parsing error: {0}
cannotLock=Cannot lock {0}
cannotSerializeXML=Cannot serialize XML
cannotWrite=Cannot write {0}
committerString=Committer {0} {1}
configurationFileInCommitHasNoProjectsDeclared=Configuration file {0} in commit {1} has no projects declared.
configurationFileInCommitIsInvalid=Configuration file {0} in commit {1} is invalid
contributorString=Contributor {0}
incorrectlyScanned=Incorrectly scanned {0}
invalidDate=Invalid date: {0}
invalidURIFormat=Invalid URI format: {0}
loginFailed=Login as {0} to {1} failed: {2}
pageTitleWas=page title was "{0}"
projectString=Project {0} ({1})
queryFailed=Query {0} failed: {1}
responseNotHTMLAsExpected=Response not HTML as expected

3
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CQ.java

@ -43,6 +43,7 @@
package org.eclipse.jgit.iplog; package org.eclipse.jgit.iplog;
import java.text.MessageFormat;
import java.util.Comparator; import java.util.Comparator;
/** /**
@ -156,6 +157,6 @@ class CQ {
@Override @Override
public String toString() { public String toString() {
return "CQ " + getID(); return MessageFormat.format(IpLogText.get().CQString, getID());
} }
} }

3
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java

@ -45,6 +45,7 @@ package org.eclipse.jgit.iplog;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -108,7 +109,7 @@ class CSV {
} }
} }
if (p < line.length() && line.charAt(p) != ',') if (p < line.length() && line.charAt(p) != ',')
throw new IOException("CSV parsing error: " + line); throw new IOException(MessageFormat.format(IpLogText.get().CSVParsingError, line));
row.add(b.toString()); row.add(b.toString());
p++; // skip the trailing comma (if present) p++; // skip the trailing comma (if present)

3
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Committer.java

@ -43,6 +43,7 @@
package org.eclipse.jgit.iplog; package org.eclipse.jgit.iplog;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -172,7 +173,7 @@ class Committer {
@Override @Override
public String toString() { public String toString() {
return "Committer " + getFirstName() + " " + getLastName(); return MessageFormat.format(IpLogText.get().committerString, getFirstName(), getLastName());
} }
/** Date period during which the committer was active. */ /** Date period during which the committer was active. */

3
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Contributor.java

@ -43,6 +43,7 @@
package org.eclipse.jgit.iplog; package org.eclipse.jgit.iplog;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -93,6 +94,6 @@ class Contributor {
@Override @Override
public String toString() { public String toString() {
return "Contributor " + getName(); return MessageFormat.format(IpLogText.get().contributorString, getName());
} }
} }

21
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IPZillaQuery.java

@ -59,6 +59,7 @@ import java.net.ProxySelector;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -135,8 +136,8 @@ class IPZillaQuery {
HttpURLConnection conn = open(csv); HttpURLConnection conn = open(csv);
if (HttpSupport.response(conn) != HttpURLConnection.HTTP_OK) { if (HttpSupport.response(conn) != HttpURLConnection.HTTP_OK) {
throw new IOException("Query " + csv + " failed: " throw new IOException(MessageFormat.format(IpLogText.get().queryFailed
+ conn.getResponseCode() + " " + conn.getResponseMessage()); , csv, conn.getResponseCode() + " " + conn.getResponseMessage()));
} }
BufferedReader br = reader(conn); BufferedReader br = reader(conn);
@ -185,23 +186,23 @@ class IPZillaQuery {
out.close(); out.close();
if (HttpSupport.response(c) != HttpURLConnection.HTTP_OK) { if (HttpSupport.response(c) != HttpURLConnection.HTTP_OK) {
throw new IOException("Login as " + username + " to " + login throw new IOException(MessageFormat.format(IpLogText.get().loginFailed
+ " failed: " + c.getResponseCode() + " " , username, login, c.getResponseCode() + " " + c.getResponseMessage()));
+ c.getResponseMessage());
} }
String content = readFully(c); String content = readFully(c);
Matcher matcher = Pattern.compile("<title>(.*)</title>", Matcher matcher = Pattern.compile("<title>(.*)</title>",
Pattern.CASE_INSENSITIVE).matcher(content); Pattern.CASE_INSENSITIVE).matcher(content);
if (!matcher.find()) { if (!matcher.find()) {
throw new IOException("Login as " + username + " to " + login throw new IOException(MessageFormat.format(IpLogText.get().loginFailed
+ " failed: Response not HTML as expected"); , username, login, IpLogText.get().responseNotHTMLAsExpected));
} }
String title = matcher.group(1); String title = matcher.group(1);
if (!"IPZilla Main Page".equals(title)) { if (!"IPZilla Main Page".equals(title)) {
throw new IOException("Login as " + username + " to " + login throw new IOException(MessageFormat.format(IpLogText.get().loginFailed
+ " failed; page title was \"" + title + "\""); , username, login
, MessageFormat.format(IpLogText.get().pageTitleWas, title)));
} }
} }
@ -246,7 +247,7 @@ class IPZillaQuery {
try { try {
CookieHandler.getDefault().put(url.toURI(), cols); CookieHandler.getDefault().put(url.toURI(), cols);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
IOException err = new IOException("Invalid URI format:" + url); IOException err = new IOException(MessageFormat.format(IpLogText.get().invalidURIFormat, url));
err.initCause(e); err.initCause(e);
throw err; throw err;
} }

21
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java

@ -48,6 +48,7 @@ import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.text.MessageFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -209,15 +210,13 @@ public class IpLogGenerator {
try { try {
meta.loadFrom(new BlobBasedConfig(null, db, log.getObjectId(0))); meta.loadFrom(new BlobBasedConfig(null, db, log.getObjectId(0)));
} catch (ConfigInvalidException e) { } catch (ConfigInvalidException e) {
throw new ConfigInvalidException("Configuration file " throw new ConfigInvalidException(MessageFormat.format(IpLogText.get().configurationFileInCommitIsInvalid
+ log.getPathString() + " in commit " + commit.name() , log.getPathString(), commit.name()), e);
+ " is invalid", e);
} }
if (meta.getProjects().isEmpty()) { if (meta.getProjects().isEmpty()) {
throw new ConfigInvalidException("Configuration file " throw new ConfigInvalidException(MessageFormat.format(IpLogText.get().configurationFileInCommitHasNoProjectsDeclared
+ log.getPathString() + " in commit " + commit.name() , log.getPathString(), commit.name()));
+ " has no projects declared.");
} }
for (Project p : meta.getProjects()) { for (Project p : meta.getProjects()) {
@ -274,7 +273,7 @@ public class IpLogGenerator {
try { try {
return dt.parse(value); return dt.parse(value);
} catch (ParseException e) { } catch (ParseException e) {
IOException err = new IOException("Invalid date: " + value); IOException err = new IOException(MessageFormat.format(IpLogText.get().invalidDate, value));
err.initCause(e); err.initCause(e);
throw err; throw err;
} }
@ -411,7 +410,7 @@ public class IpLogGenerator {
} }
if (addedLines < 0) if (addedLines < 0)
throw new IOException("Incorrectly scanned " + commit.name()); throw new IOException(MessageFormat.format(IpLogText.get().incorrectlyScanned, commit.name()));
if (1 == addedLines) if (1 == addedLines)
item.setSize("+1 line"); item.setSize("+1 line");
else else
@ -447,17 +446,17 @@ public class IpLogGenerator {
s.setOutputProperty(INDENT, "2"); s.setOutputProperty(INDENT, "2");
s.transform(new DOMSource(toXML()), new StreamResult(out)); s.transform(new DOMSource(toXML()), new StreamResult(out));
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
IOException err = new IOException("Cannot serialize XML"); IOException err = new IOException(IpLogText.get().cannotSerializeXML);
err.initCause(e); err.initCause(e);
throw err; throw err;
} catch (TransformerConfigurationException e) { } catch (TransformerConfigurationException e) {
IOException err = new IOException("Cannot serialize XML"); IOException err = new IOException(IpLogText.get().cannotSerializeXML);
err.initCause(e); err.initCause(e);
throw err; throw err;
} catch (TransformerException e) { } catch (TransformerException e) {
IOException err = new IOException("Cannot serialize XML"); IOException err = new IOException(IpLogText.get().cannotSerializeXML);
err.initCause(e); err.initCause(e);
throw err; throw err;
} }

5
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java

@ -46,6 +46,7 @@ package org.eclipse.jgit.iplog;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -155,7 +156,7 @@ public class IpLogMeta {
LockFile lf = new LockFile(file); LockFile lf = new LockFile(file);
if (!lf.lock()) if (!lf.lock())
throw new IOException("Cannot lock " + file); throw new IOException(MessageFormat.format(IpLogText.get().cannotLock, file));
try { try {
FileBasedConfig cfg = new FileBasedConfig(file); FileBasedConfig cfg = new FileBasedConfig(file);
cfg.load(); cfg.load();
@ -181,7 +182,7 @@ public class IpLogMeta {
lf.write(Constants.encode(cfg.toText())); lf.write(Constants.encode(cfg.toText()));
if (!lf.commit()) if (!lf.commit())
throw new IOException("Cannot write " + file); throw new IOException(MessageFormat.format(IpLogText.get().cannotWrite, file));
} finally { } finally {
lf.unlock(); lf.unlock();
} }

78
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogText.java

@ -0,0 +1,78 @@
/*
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.eclipse.jgit.iplog;
import org.eclipse.jgit.nls.NLS;
import org.eclipse.jgit.nls.TranslationBundle;
/**
* Translation bundle for JGit IP Log
*/
public class IpLogText extends TranslationBundle {
/**
* @return an instance of this translation bundle
*/
public static IpLogText get() {
return NLS.getBundleFor(IpLogText.class);
}
/***/ public String CQString;
/***/ public String CSVParsingError;
/***/ public String cannotLock;
/***/ public String cannotSerializeXML;
/***/ public String cannotWrite;
/***/ public String committerString;
/***/ public String configurationFileInCommitHasNoProjectsDeclared;
/***/ public String configurationFileInCommitIsInvalid;
/***/ public String contributorString;
/***/ public String incorrectlyScanned;
/***/ public String invalidDate;
/***/ public String invalidURIFormat;
/***/ public String loginFailed;
/***/ public String pageTitleWas;
/***/ public String projectString;
/***/ public String queryFailed;
/***/ public String responseNotHTMLAsExpected;
}

3
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Project.java

@ -43,6 +43,7 @@
package org.eclipse.jgit.iplog; package org.eclipse.jgit.iplog;
import java.text.MessageFormat;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Set; import java.util.Set;
@ -128,6 +129,6 @@ class Project {
@Override @Override
public String toString() { public String toString() {
return "Project " + getID() + " (" + getName() + ")"; return MessageFormat.format(IpLogText.get().projectString, getID(), getName());
} }
} }

3
org.eclipse.jgit.pgm/.classpath

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry excluding="*" including="META-INF/" kind="src" path=""/> <classpathentry excluding="*|resources/|resources/" including="META-INF/" kind="src" path=""/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

13
org.eclipse.jgit.pgm/META-INF/MANIFEST.MF

@ -11,7 +11,9 @@ Import-Package: org.eclipse.jgit.api;version="[0.8.0,0.9.0)",
org.eclipse.jgit.diff;version="[0.8.0,0.9.0)", org.eclipse.jgit.diff;version="[0.8.0,0.9.0)",
org.eclipse.jgit.dircache;version="[0.8.0,0.9.0)", org.eclipse.jgit.dircache;version="[0.8.0,0.9.0)",
org.eclipse.jgit.errors;version="[0.8.0,0.9.0)", org.eclipse.jgit.errors;version="[0.8.0,0.9.0)",
org.eclipse.jgit.iplog;version="[0.8.0,0.9.0)",
org.eclipse.jgit.lib;version="[0.8.0,0.9.0)", org.eclipse.jgit.lib;version="[0.8.0,0.9.0)",
org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)", org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk.filter;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk.filter;version="[0.8.0,0.9.0)",
@ -19,10 +21,17 @@ Import-Package: org.eclipse.jgit.api;version="[0.8.0,0.9.0)",
org.eclipse.jgit.treewalk;version="[0.8.0,0.9.0)", org.eclipse.jgit.treewalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.treewalk.filter;version="[0.8.0,0.9.0)", org.eclipse.jgit.treewalk.filter;version="[0.8.0,0.9.0)",
org.eclipse.jgit.util;version="[0.8.0,0.9.0)", org.eclipse.jgit.util;version="[0.8.0,0.9.0)",
org.eclipse.jgit.iplog;version="[0.8.0,0.9.0)",
org.kohsuke.args4j;version="[2.0.12,2.1.0)", org.kohsuke.args4j;version="[2.0.12,2.1.0)",
org.kohsuke.args4j.spi;version="[2.0.12,2.1.0)" org.kohsuke.args4j.spi;version="[2.0.12,2.1.0)"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.jgit.pgm Export-Package: org.eclipse.jgit.pgm;version="0.8.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.nls,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
javax.swing,
org.eclipse.jgit.pgm.opt,
org.eclipse.jgit.awtui,
org.eclipse.jgit.transport"
Main-Class: org.eclipse.jgit.pgm.Main Main-Class: org.eclipse.jgit.pgm.Main
Implementation-Title: JGit Command Line Interface Implementation-Title: JGit Command Line Interface

3
org.eclipse.jgit.pgm/pom.xml

@ -111,6 +111,9 @@
<include>META-INF/services/org.eclipse.jgit.pgm.TextBuiltin</include> <include>META-INF/services/org.eclipse.jgit.pgm.TextBuiltin</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>resources/</directory>
</resource>
</resources> </resources>
<plugins> <plugins>

174
org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties

@ -0,0 +1,174 @@
# default meta variable defined in the org.kohsuke.args4j.spi.StringOptionHandler
VAL=VAL
# default meta variable defined in the org.kohsuke.args4j.spi.StopOptionHandler
ARGUMENTS=ARGUMENTS
# default meta variable defined in the org.kohsuke.args4j.spi.OneArgumentOptionHandler
N=N
IPZillaPasswordPrompt=IPZilla Password
authorInfo=Author: {0} <{1}>
averageMSPerRead=average {0} ms/read
branchAlreadyExists=branch {0} already exists
branchCreatedFrom =branch: Created from {0}
branchIsNotAnAncestorOfYourCurrentHEAD=The branch '{0}' is not an ancestor of your current HEAD.\nIf you are sure you want to delete it, run 'jgit branch -D {0}'.
branchNotFound=branch '{0}' not found.
cacheTreePathInfo="{0}": {1} entries, {2} children
cannotBeRenamed={0} cannot be renamed
cannotChekoutNoHeadsAdvertisedByRemote=cannot checkout; no HEAD advertised by remote
cannotCreateCommand=Cannot create command {0}
cannotCreateOutputStream=cannot create output stream
cannotDeatchHEAD=Cannot deatch HEAD
cannotDeleteTheBranchWhichYouAreCurrentlyOn=Cannot delete the branch '{0}' which you are currently on.
cannotGuessLocalNameFrom=cannot guess local name from {0}
cannotLock=Cannot lock {0}
cannotReadBecause=cannot read {0}: {1}
cannotReadPackageInformation=Cannot read package information.
cannotRenameDetachedHEAD=Cannot rename detached HEAD
cannotResolve=Cannot resolve {0}
cannotSetupConsole=Cannot setup console
cannotUseObjectsWithGlog=Cannot use --objects with glog
cannotWrite=Cannot write {0}
cantFindGitDirectory=error: can't find git directory
cantWrite=Can't write {0}
commitLabel=commit
conflictingUsageOf_git_dir_andArguments=conflicting usage of --git-dir and arguments
couldNotCreateBranch=Could not create branch {0}: {1}
dateInfo=Date: {0}
deletedBranch=Deleted branch {0}
deletedRemoteBranch=Deleted remote branch {0}
doesNotExist={0} does not exist
everythingUpToDate=Everything up-to-date
expectedNumberOfbytes=Expected {0} bytes.
exporting=Exporting {0}
failedToCommitIndex=failed to commit index
failedToLockIndex=failed to lock index
fatalError=fatal: {0}
fatalErrorTagExists=fatal: tag '{0}' exists
fatalThisProgramWillDestroyTheRepository=fatal: This program will destroy the repository\nfatal:\nfatal:\nfatal: {0}\nfatal:\nfatal: To continue, add {1} to the command line\nfatal:
forcedUpdate=forced update
fromURI=From {0}
initializedEmptyGitRepositoryIn=Initialized empty Git repository in {0}
invalidHttpProxyOnlyHttpSupported=Invalid http_proxy: {0}: Only http supported.
jgitVersion=jgit version {0}
listeningOn=Listening on {0}
metaVar_DAG=DAG
metaVar_KEY=KEY
metaVar_arg=ARG
metaVar_base=base
metaVar_bucket=BUCKET
metaVar_command=command
metaVar_commitOrTag=COMMIT|TAG
metaVar_commitish=commit-ish
metaVar_connProp=conn.prop
metaVar_directory=DIRECTORY
metaVar_file=FILE
metaVar_gitDir=GIT_DIR
metaVar_hostName=HOSTNAME
metaVar_message=message
metaVar_name=name
metaVar_object=object
metaVar_op=OP
metaVar_pass=PASS
metaVar_path=path
metaVar_paths=path ...
metaVar_port=PORT
metaVar_refs=REFS
metaVar_refspec=refspec
metaVar_remoteName=name
metaVar_seconds=SECONDS
metaVar_service=SERVICE
metaVar_treeish=tree-ish
metaVar_uriish=uri-ish
metaVar_url=URL
metaVar_user=USER
metaVar_version=VERSION
mostCommonlyUsedCommandsAre=The most commonly used commands are:
needApprovalToDestroyCurrentRepository=Need approval to destroy current repository
noGitRepositoryConfigured=No Git repository configured.
noSuchFile=no such file: {0}
noTREESectionInIndex=no 'TREE' section in index
nonFastForward=non-fast forward
notABranch={0} is not a branch
notACommit={0} is not a commit
notAGitRepository='{0}' not a git repository
notAJgitCommand={0} is not a jgit command
notARevision=Not a revision: {0}
notATagVersionIsRequired={0} is not a tag, --version is required
notATree={0} is not a tree
notAValidRefName={0} is not a valid ref name
notAnIndexFile={0} is not an index file
notAnObject={0} is not an object
notFound=!! NOT FOUND !!
onlyOneMetaVarExpectedIn=Only one {0} expected in {1}.
pushTo=To {0}
remoteMessage=remote: {0}
remoteRefObjectChangedIsNotExpectedOne=remote ref object changed - is not expected one {0}
remoteSideDoesNotSupportDeletingRefs=remote side does not support deleting refs
repaint=Repaint
serviceNotSupported=Service '{0}' not supported
skippingObject=skipping {0} {1}
timeInMilliSeconds={0} ms
tooManyRefsGiven=Too many refs given
unsupportedOperation=Unsupported operation: {0}
usage_CommandLineClientForamazonsS3Service=Command line client for Amazon's S3 service
usage_CreateABareRepository=Create a bare repository
usage_CreateATag=Create a tag
usage_CreateAnEmptyGitRepository=Create an empty git repository
usage_DisplayTheVersionOfJgit=Display the version of jgit
usage_IPZillaPassword=IPZilla Password
usage_IPZillaURL=IPZilla URL
usage_IPZillausername=IPZilla Username
usage_RepositoryToReadFrom=Repository to read from
usage_RepositoryToReceiveInto=Repository to receive into
usage_ServerSideBackendForJgitFetch=Server side backend for 'jgit fetch'
usage_ServerSideBackendForJgitPush=Server side backend for 'jgit push'
usage_ShowDiffs=Show diffs
usage_StopTrackingAFile=Stop tracking a file
usage_UpdateRemoteRepositoryFromLocalRefs=Update remote repository from local refs
usage_abortConnectionIfNoActivity=abort connection if no activity
usage_actOnRemoteTrackingBranches=act on remote-tracking branches
usage_alterTheDetailShown=alter the detail shown
usage_approveDestructionOfRepository=approve destruction of repository
usage_beMoreVerbose=be more verbose
usage_beVerbose=be verbose
usage_cloneRepositoryIntoNewDir=Clone a repository into a new directory
usage_configureTheServiceInDaemonServicename=configure the service in daemon.servicename
usage_deleteBranchEvenIfNotMerged=delete branch (even if not merged)
usage_deleteFullyMergedBranch=delete fully merged branch
usage_directoriesToExport=directories to export
usage_disableTheServiceInAllRepositories=disable the service in all repositories
usage_displayAListOfAllRegisteredJgitCommands=Display a list of all registered jgit commands
usage_displayAllPossibleMergeBases=display all possible merge bases
usage_displayThejavaStackTraceOnExceptions=display the Java stack trace on exceptions
usage_displayThisHelpText=display this help text
usage_enableTheServiceInAllRepositories=enable the service in all repositories
usage_exportRepositoriesOverGit=Export repositories over git://
usage_exportWithoutGitDaemonExportOk=export without git-daemon-export-ok
usage_fetchThinPack=fetch thin pack
usage_fixAThinPackToBeComplete=fix a thin pack to be complete
usage_forEachRefOutput=for-each-ref output
usage_forceCreateBranchEvenExists=force create branch even exists
usage_forceReplacingAnExistingTag=force replacing an existing tag
usage_hostnameOrIpToListenOn=hostname (or ip) to listen on
usage_indexFileFormatToCreate=index file format to create
usage_inputOutputFile=Input/output file
usage_listBothRemoteTrackingAndLocalBranches=list both remote-tracking and local branches
usage_listCreateOrDeleteBranches=List, create, or delete branches
usage_logAllPretty=format:%H %ct %P' output=log --all '--pretty=format:%H %ct %P' output
usage_moveRenameABranch=move/rename a branch
usage_outputFile=Output file
usage_path=path
usage_performFsckStyleChecksOnReceive=perform fsck style checks on receive
usage_portNumberToListenOn=port number to listen on
usage_produceAnEclipseIPLog=Produce an Eclipse IP log
usage_pruneStaleTrackingRefs=prune stale tracking refs
usage_recurseIntoSubtrees=recurse into subtrees
usage_setTheGitRepositoryToOperateOn=set the git repository to operate on
usage_showRefNamesMatchingCommits=Show ref names matching commits
usage_symbolicVersionForTheProject=Symbolic version for the project
usage_synchronizeIPZillaData=Synchronize IPZilla data
usage_tagMessage=tag message
usage_updateRemoteRefsFromAnotherRepository=Update remote refs from another repository
usage_useNameInsteadOfOriginToTrackUpstream=use <name> instead of 'origin' to track upstream
usage_viewCommitHistory=View commit history
warningNoCommitGivenOnCommandLine=warning: No commit given on command line, assuming {0}

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

@ -3,6 +3,7 @@
* Copyright (C) 2008-2010, Google Inc. * Copyright (C) 2008-2010, Google Inc.
* Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com> * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log. * and other copyright owners as documented in the project's IP log.
* *
* This program and the accompanying materials are made available * This program and the accompanying materials are made available
@ -46,6 +47,8 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.PrintWriter;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
@ -55,7 +58,7 @@ import org.eclipse.jgit.transport.TrackingRefUpdate;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
abstract class AbstractFetchCommand extends TextBuiltin { abstract class AbstractFetchCommand extends TextBuiltin {
@Option(name = "--verbose", aliases = { "-v" }, usage = "be more verbose") @Option(name = "--verbose", aliases = { "-v" }, usage = "usage_beMoreVerbose")
private boolean verbose; private boolean verbose;
protected void showFetchResult(final Transport tn, final FetchResult r) { protected void showFetchResult(final Transport tn, final FetchResult r) {
@ -70,8 +73,7 @@ abstract class AbstractFetchCommand extends TextBuiltin {
final String dst = abbreviateRef(u.getLocalName(), true); final String dst = abbreviateRef(u.getLocalName(), true);
if (!shownURI) { if (!shownURI) {
out.print("From "); out.format(CLIText.get().fromURI, tn.getURI());
out.print(tn.getURI());
out.println(); out.println();
shownURI = true; shownURI = true;
} }
@ -84,6 +86,7 @@ abstract class AbstractFetchCommand extends TextBuiltin {
} }
static void showRemoteMessages(String pkt) { static void showRemoteMessages(String pkt) {
PrintWriter writer = new PrintWriter(System.err);
while (0 < pkt.length()) { while (0 < pkt.length()) {
final int lf = pkt.indexOf('\n'); final int lf = pkt.indexOf('\n');
final int cr = pkt.indexOf('\r'); final int cr = pkt.indexOf('\r');
@ -95,18 +98,22 @@ abstract class AbstractFetchCommand extends TextBuiltin {
else if (0 <= cr) else if (0 <= cr)
s = cr; s = cr;
else { else {
System.err.println("remote: " + pkt); writer.format(CLIText.get().remoteMessage, pkt);
writer.println();
break; break;
} }
if (pkt.charAt(s) == '\r') if (pkt.charAt(s) == '\r') {
System.err.print("remote: " + pkt.substring(0, s) + "\r"); writer.format(CLIText.get().remoteMessage, pkt.substring(0, s));
else writer.print('\r');
System.err.println("remote: " + pkt.substring(0, s)); } else {
writer.format(CLIText.get().remoteMessage, pkt.substring(0, s));
writer.println();
}
pkt = pkt.substring(s + 1); pkt = pkt.substring(s + 1);
} }
System.err.flush(); writer.flush();
} }
private String longTypeOf(final TrackingRefUpdate u) { private String longTypeOf(final TrackingRefUpdate u) {

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

@ -52,23 +52,24 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URLConnection; import java.net.URLConnection;
import java.text.MessageFormat;
import java.util.Properties; import java.util.Properties;
import org.eclipse.jgit.transport.AmazonS3; import org.eclipse.jgit.transport.AmazonS3;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
@Command(name = "amazon-s3-client", common = false, usage = "Command line client for Amazon's S3 service") @Command(name = "amazon-s3-client", common = false, usage = "usage_CommandLineClientForamazonsS3Service")
class AmazonS3Client extends TextBuiltin { class AmazonS3Client extends TextBuiltin {
@Argument(index = 0, metaVar = "conn.prop", required = true) @Argument(index = 0, metaVar = "metaVar_connProp", required = true)
private File propertyFile; private File propertyFile;
@Argument(index = 1, metaVar = "OP", required = true) @Argument(index = 1, metaVar = "metaVar_op", required = true)
private String op; private String op;
@Argument(index = 2, metaVar = "BUCKET", required = true) @Argument(index = 2, metaVar = "metaVar_bucket", required = true)
private String bucket; private String bucket;
@Argument(index = 3, metaVar = "KEY", required = true) @Argument(index = 3, metaVar = "metaVar_KEY", required = true)
private String key; private String key;
@Override @Override
@ -89,7 +90,7 @@ class AmazonS3Client extends TextBuiltin {
while (len > 0) { while (len > 0) {
final int n = in.read(tmp); final int n = in.read(tmp);
if (n < 0) if (n < 0)
throw new EOFException("Expected " + len + " bytes."); throw new EOFException(MessageFormat.format(CLIText.get().expectedNumberOfbytes, len));
System.out.write(tmp, 0, n); System.out.write(tmp, 0, n);
len -= n; len -= n;
} }
@ -113,7 +114,7 @@ class AmazonS3Client extends TextBuiltin {
os.close(); os.close();
} else { } else {
throw die("Unsupported operation: " + op); throw die(MessageFormat.format(CLIText.get().unsupportedOperation, op));
} }
} }
@ -128,9 +129,9 @@ class AmazonS3Client extends TextBuiltin {
in.close(); in.close();
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw die("no such file: " + propertyFile, e); throw die(MessageFormat.format(CLIText.get().noSuchFile, propertyFile), e);
} catch (IOException e) { } catch (IOException e) {
throw die("cannot read " + propertyFile, e); throw die(MessageFormat.format(CLIText.get().cannotReadBecause, propertyFile, e.getMessage()), e);
} }
} }
} }

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

@ -44,6 +44,7 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -64,28 +65,28 @@ import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.ExampleMode; import org.kohsuke.args4j.ExampleMode;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
@Command(common = true, usage = "List, create, or delete branches") @Command(common = true, usage = "usage_listCreateOrDeleteBranches")
class Branch extends TextBuiltin { class Branch extends TextBuiltin {
@Option(name = "--remote", aliases = { "-r" }, usage = "act on remote-tracking branches") @Option(name = "--remote", aliases = { "-r" }, usage = "usage_actOnRemoteTrackingBranches")
private boolean remote = false; private boolean remote = false;
@Option(name = "--all", aliases = { "-a" }, usage = "list both remote-tracking and local branches") @Option(name = "--all", aliases = { "-a" }, usage = "usage_listBothRemoteTrackingAndLocalBranches")
private boolean all = false; private boolean all = false;
@Option(name = "--delete", aliases = { "-d" }, usage = "delete fully merged branch") @Option(name = "--delete", aliases = { "-d" }, usage = "usage_deleteFullyMergedBranch")
private boolean delete = false; private boolean delete = false;
@Option(name = "--delete-force", aliases = { "-D" }, usage = "delete branch (even if not merged)") @Option(name = "--delete-force", aliases = { "-D" }, usage = "usage_deleteBranchEvenIfNotMerged")
private boolean deleteForce = false; private boolean deleteForce = false;
@Option(name = "--create-force", aliases = { "-f" }, usage = "force create branch even exists") @Option(name = "--create-force", aliases = { "-f" }, usage = "usage_forceCreateBranchEvenExists")
private boolean createForce = false; private boolean createForce = false;
@Option(name = "-m", usage = "move/rename a branch") @Option(name = "-m", usage = "usage_moveRenameABranch")
private boolean rename = false; private boolean rename = false;
@Option(name = "--verbose", aliases = { "-v" }, usage = "be verbose") @Option(name = "--verbose", aliases = { "-v" }, usage = "usage_beVerbose")
private boolean verbose = false; private boolean verbose = false;
@Argument @Argument
@ -104,7 +105,7 @@ class Branch extends TextBuiltin {
delete(deleteForce); delete(deleteForce);
else { else {
if (branches.size() > 2) if (branches.size() > 2)
throw die("Too many refs given\n" + new CmdLineParser(this).printExample(ExampleMode.ALL)); throw die(CLIText.get().tooManyRefsGiven + new CmdLineParser(this).printExample(ExampleMode.ALL));
if (rename) { if (rename) {
String src, dst; String src, dst;
@ -113,15 +114,15 @@ class Branch extends TextBuiltin {
if (head != null && head.isSymbolic()) if (head != null && head.isSymbolic())
src = head.getLeaf().getName(); src = head.getLeaf().getName();
else else
throw die("Cannot rename detached HEAD"); throw die(CLIText.get().cannotRenameDetachedHEAD);
dst = branches.get(0); dst = branches.get(0);
} else { } else {
src = branches.get(0); src = branches.get(0);
final Ref old = db.getRef(src); final Ref old = db.getRef(src);
if (old == null) if (old == null)
throw die(String.format("%s does not exist", src)); throw die(MessageFormat.format(CLIText.get().doesNotExist, src));
if (!old.getName().startsWith(Constants.R_HEADS)) if (!old.getName().startsWith(Constants.R_HEADS))
throw die(String.format("%s is not a branch", src)); throw die(MessageFormat.format(CLIText.get().notABranch, src));
src = old.getName(); src = old.getName();
dst = branches.get(1); dst = branches.get(1);
} }
@ -129,11 +130,11 @@ class Branch extends TextBuiltin {
if (!dst.startsWith(Constants.R_HEADS)) if (!dst.startsWith(Constants.R_HEADS))
dst = Constants.R_HEADS + dst; dst = Constants.R_HEADS + dst;
if (!Repository.isValidRefName(dst)) if (!Repository.isValidRefName(dst))
throw die(String.format("%s is not a valid ref name", dst)); throw die(MessageFormat.format(CLIText.get().notAValidRefName, dst));
RefRename r = db.renameRef(src, dst); RefRename r = db.renameRef(src, dst);
if (r.rename() != Result.RENAMED) if (r.rename() != Result.RENAMED)
throw die(String.format("%s cannot be renamed", src)); throw die(MessageFormat.format(CLIText.get().cannotBeRenamed, src));
} else if (branches.size() > 0) { } else if (branches.size() > 0) {
String newHead = branches.get(0); String newHead = branches.get(0);
@ -153,16 +154,16 @@ class Branch extends TextBuiltin {
if (!newRefName.startsWith(Constants.R_HEADS)) if (!newRefName.startsWith(Constants.R_HEADS))
newRefName = Constants.R_HEADS + newRefName; newRefName = Constants.R_HEADS + newRefName;
if (!Repository.isValidRefName(newRefName)) if (!Repository.isValidRefName(newRefName))
throw die(String.format("%s is not a valid ref name", newRefName)); throw die(MessageFormat.format(CLIText.get().notAValidRefName, newRefName));
if (!createForce && db.resolve(newRefName) != null) if (!createForce && db.resolve(newRefName) != null)
throw die(String.format("branch %s already exists", newHead)); throw die(MessageFormat.format(CLIText.get().branchAlreadyExists, newHead));
RefUpdate updateRef = db.updateRef(newRefName); RefUpdate updateRef = db.updateRef(newRefName);
updateRef.setNewObjectId(startAt); updateRef.setNewObjectId(startAt);
updateRef.setForceUpdate(createForce); updateRef.setForceUpdate(createForce);
updateRef.setRefLogMessage("branch: Created from " + startBranch, false); updateRef.setRefLogMessage(MessageFormat.format(CLIText.get().branchCreatedFrom, startBranch), false);
Result update = updateRef.update(); Result update = updateRef.update();
if (update == Result.REJECTED) if (update == Result.REJECTED)
throw die(String.format("Could not create branch %s: %s", newHead, update.toString())); throw die(MessageFormat.format(CLIText.get().couldNotCreateBranch, newHead, update.toString()));
} else { } else {
if (verbose) if (verbose)
rw = new RevWalk(db); rw = new RevWalk(db);
@ -211,7 +212,7 @@ class Branch extends TextBuiltin {
out.print(ref); out.print(ref);
if (verbose) { if (verbose) {
final int spaces = maxNameLength - ref.length() + 1; final int spaces = maxNameLength - ref.length() + 1;
out.print(String.format("%" + spaces + "s", "")); out.format("%" + spaces + "s", "");
final ObjectId objectId = refObj.getObjectId(); final ObjectId objectId = refObj.getObjectId();
out.print(objectId.abbreviate(db).name()); out.print(objectId.abbreviate(db).name());
out.print(' '); out.print(' ');
@ -225,8 +226,7 @@ class Branch extends TextBuiltin {
ObjectId head = db.resolve(Constants.HEAD); ObjectId head = db.resolve(Constants.HEAD);
for (String branch : branches) { for (String branch : branches) {
if (current.equals(branch)) { if (current.equals(branch)) {
String err = "Cannot delete the branch '%s' which you are currently on."; throw die(MessageFormat.format(CLIText.get().cannotDeleteTheBranchWhichYouAreCurrentlyOn, branch));
throw die(String.format(err, branch));
} }
RefUpdate update = db.updateRef((remote ? Constants.R_REMOTES RefUpdate update = db.updateRef((remote ? Constants.R_REMOTES
: Constants.R_HEADS) : Constants.R_HEADS)
@ -235,15 +235,13 @@ class Branch extends TextBuiltin {
update.setForceUpdate(force || remote); update.setForceUpdate(force || remote);
Result result = update.delete(); Result result = update.delete();
if (result == Result.REJECTED) { if (result == Result.REJECTED) {
String err = "The branch '%s' is not an ancestor of your current HEAD.\n" throw die(MessageFormat.format(CLIText.get().branchIsNotAnAncestorOfYourCurrentHEAD, branch));
+ "If you are sure you want to delete it, run 'jgit branch -D %1$s'.";
throw die(String.format(err, branch));
} else if (result == Result.NEW) } else if (result == Result.NEW)
throw die(String.format("branch '%s' not found.", branch)); throw die(MessageFormat.format(CLIText.get().branchNotFound, branch));
if (remote) if (remote)
out.println(String.format("Deleted remote branch %s", branch)); out.println(MessageFormat.format(CLIText.get().deletedRemoteBranch, branch));
else if (verbose) else if (verbose)
out.println(String.format("Deleted branch %s", branch)); out.println(MessageFormat.format(CLIText.get().deletedBranch, branch));
} }
} }
} }

142
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java

@ -0,0 +1,142 @@
/*
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.eclipse.jgit.pgm;
import org.eclipse.jgit.nls.NLS;
import org.eclipse.jgit.nls.TranslationBundle;
/**
* Translation bundle for JGit command line interface
*/
public class CLIText extends TranslationBundle {
/**
* @return an instance of this translation bundle
*/
public static CLIText get() {
return NLS.getBundleFor(CLIText.class);
}
/***/ public String IPZillaPasswordPrompt;
/***/ public String authorInfo;
/***/ public String averageMSPerRead;
/***/ public String branchAlreadyExists;
/***/ public String branchCreatedFrom;
/***/ public String branchIsNotAnAncestorOfYourCurrentHEAD;
/***/ public String branchNotFound;
/***/ public String cacheTreePathInfo;
/***/ public String cannotBeRenamed;
/***/ public String cannotChekoutNoHeadsAdvertisedByRemote;
/***/ public String cannotCreateCommand;
/***/ public String cannotCreateOutputStream;
/***/ public String cannotDeatchHEAD;
/***/ public String cannotDeleteTheBranchWhichYouAreCurrentlyOn;
/***/ public String cannotGuessLocalNameFrom;
/***/ public String cannotLock;
/***/ public String cannotReadBecause;
/***/ public String cannotReadPackageInformation;
/***/ public String cannotRenameDetachedHEAD;
/***/ public String cannotResolve;
/***/ public String cannotSetupConsole;
/***/ public String cannotUseObjectsWithGlog;
/***/ public String cannotWrite;
/***/ public String cantFindGitDirectory;
/***/ public String cantWrite;
/***/ public String commitLabel;
/***/ public String conflictingUsageOf_git_dir_andArguments;
/***/ public String couldNotCreateBranch;
/***/ public String dateInfo;
/***/ public String deletedBranch;
/***/ public String deletedRemoteBranch;
/***/ public String doesNotExist;
/***/ public String everythingUpToDate;
/***/ public String expectedNumberOfbytes;
/***/ public String exporting;
/***/ public String failedToCommitIndex;
/***/ public String failedToLockIndex;
/***/ public String fatalError;
/***/ public String fatalErrorTagExists;
/***/ public String fatalThisProgramWillDestroyTheRepository;
/***/ public String forcedUpdate;
/***/ public String fromURI;
/***/ public String initializedEmptyGitRepositoryIn;
/***/ public String invalidHttpProxyOnlyHttpSupported;
/***/ public String jgitVersion;
/***/ public String listeningOn;
/***/ public String metaVar_command;
/***/ public String metaVar_commitish;
/***/ public String metaVar_object;
/***/ public String metaVar_paths;
/***/ public String metaVar_refspec;
/***/ public String metaVar_treeish;
/***/ public String mostCommonlyUsedCommandsAre;
/***/ public String needApprovalToDestroyCurrentRepository;
/***/ public String noGitRepositoryConfigured;
/***/ public String noSuchFile;
/***/ public String noTREESectionInIndex;
/***/ public String nonFastForward;
/***/ public String notABranch;
/***/ public String notACommit;
/***/ public String notAGitRepository;
/***/ public String notAJgitCommand;
/***/ public String notARevision;
/***/ public String notATagVersionIsRequired;
/***/ public String notATree;
/***/ public String notAValidRefName;
/***/ public String notAnIndexFile;
/***/ public String notAnObject;
/***/ public String notFound;
/***/ public String onlyOneMetaVarExpectedIn;
/***/ public String pushTo;
/***/ public String remoteMessage;
/***/ public String remoteRefObjectChangedIsNotExpectedOne;
/***/ public String remoteSideDoesNotSupportDeletingRefs;
/***/ public String repaint;
/***/ public String serviceNotSupported;
/***/ public String skippingObject;
/***/ public String timeInMilliSeconds;
/***/ public String tooManyRefsGiven;
/***/ public String unsupportedOperation;
/***/ public String warningNoCommitGivenOnCommandLine;
}

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

@ -46,6 +46,7 @@ package org.eclipse.jgit.pgm;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -70,15 +71,15 @@ import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
@Command(common = true, usage = "Clone a repository into a new directory") @Command(common = true, usage = "usage_cloneRepositoryIntoNewDir")
class Clone extends AbstractFetchCommand { class Clone extends AbstractFetchCommand {
@Option(name = "--origin", aliases = { "-o" }, metaVar = "name", usage = "use <name> instead of 'origin' to track upstream") @Option(name = "--origin", aliases = { "-o" }, metaVar = "metaVar_remoteName", usage = "usage_useNameInsteadOfOriginToTrackUpstream")
private String remoteName = Constants.DEFAULT_REMOTE_NAME; private String remoteName = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 0, required = true, metaVar = "uri-ish") @Argument(index = 0, required = true, metaVar = "metaVar_uriish")
private String sourceUri; private String sourceUri;
@Argument(index = 1, metaVar = "directory") @Argument(index = 1, metaVar = "metaVar_directory")
private String localName; private String localName;
@Override @Override
@ -89,14 +90,14 @@ class Clone extends AbstractFetchCommand {
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (localName != null && gitdir != null) if (localName != null && gitdir != null)
throw die("conflicting usage of --git-dir and arguments"); throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments);
final URIish uri = new URIish(sourceUri); final URIish uri = new URIish(sourceUri);
if (localName == null) { if (localName == null) {
try { try {
localName = uri.getHumanishName(); localName = uri.getHumanishName();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw die("cannot guess local name from " + sourceUri); throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri));
} }
} }
if (gitdir == null) if (gitdir == null)
@ -107,8 +108,8 @@ class Clone extends AbstractFetchCommand {
db.getConfig().setBoolean("core", null, "bare", false); db.getConfig().setBoolean("core", null, "bare", false);
db.getConfig().save(); db.getConfig().save();
out.println("Initialized empty Git repository in " out.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath());
+ gitdir.getAbsolutePath()); out.println();
out.flush(); out.flush();
saveRemote(uri); saveRemote(uri);
@ -163,7 +164,7 @@ class Clone extends AbstractFetchCommand {
private void doCheckout(final Ref branch) throws IOException { private void doCheckout(final Ref branch) throws IOException {
if (branch == null) if (branch == null)
throw die("cannot checkout; no HEAD advertised by remote"); throw die(CLIText.get().cannotChekoutNoHeadsAdvertisedByRemote);
if (!Constants.HEAD.equals(branch.getName())) { if (!Constants.HEAD.equals(branch.getName())) {
RefUpdate u = db.updateRef(Constants.HEAD); RefUpdate u = db.updateRef(Constants.HEAD);
u.disableRefLog(); u.disableRefLog();
@ -183,4 +184,4 @@ class Clone extends AbstractFetchCommand {
co.checkout(); co.checkout();
index.write(); index.write();
} }
} }

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

@ -45,6 +45,7 @@ package org.eclipse.jgit.pgm;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
/** /**
* Description of a command (a {@link TextBuiltin} subclass. * Description of a command (a {@link TextBuiltin} subclass.
@ -140,9 +141,9 @@ public class CommandRef {
try { try {
c = impl.getDeclaredConstructor(); c = impl.getDeclaredConstructor();
} catch (SecurityException e) { } catch (SecurityException e) {
throw new RuntimeException("Cannot create command " + getName(), e); throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new RuntimeException("Cannot create command " + getName(), e); throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
} }
c.setAccessible(true); c.setAccessible(true);
@ -150,13 +151,13 @@ public class CommandRef {
try { try {
r = c.newInstance(); r = c.newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
throw new RuntimeException("Cannot create command " + getName(), e); throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new RuntimeException("Cannot create command " + getName(), e); throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new RuntimeException("Cannot create command " + getName(), e); throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
throw new RuntimeException("Cannot create command " + getName(), e); throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
} }
r.setCommandName(getName()); r.setCommandName(getName());
return r; return r;

29
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java

@ -45,6 +45,7 @@ package org.eclipse.jgit.pgm;
import java.io.File; import java.io.File;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -52,33 +53,33 @@ import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.transport.DaemonService; import org.eclipse.jgit.transport.DaemonService;
@Command(common = true, usage = "Export repositories over git://") @Command(common = true, usage = "usage_exportRepositoriesOverGit")
class Daemon extends TextBuiltin { class Daemon extends TextBuiltin {
@Option(name = "--port", metaVar = "PORT", usage = "port number to listen on") @Option(name = "--port", metaVar = "metaVar_port", usage = "usage_portNumberToListenOn")
int port = org.eclipse.jgit.transport.Daemon.DEFAULT_PORT; int port = org.eclipse.jgit.transport.Daemon.DEFAULT_PORT;
@Option(name = "--listen", metaVar = "HOSTNAME", usage = "hostname (or ip) to listen on") @Option(name = "--listen", metaVar = "metaVar_hostName", usage = "usage_hostnameOrIpToListenOn")
String host; String host;
@Option(name = "--timeout", metaVar = "SECONDS", usage = "abort connection if no activity") @Option(name = "--timeout", metaVar = "metaVar_seconds", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1; int timeout = -1;
@Option(name = "--enable", metaVar = "SERVICE", usage = "enable the service in all repositories", multiValued = true) @Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories", multiValued = true)
final List<String> enable = new ArrayList<String>(); final List<String> enable = new ArrayList<String>();
@Option(name = "--disable", metaVar = "SERVICE", usage = "disable the service in all repositories", multiValued = true) @Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories", multiValued = true)
final List<String> disable = new ArrayList<String>(); final List<String> disable = new ArrayList<String>();
@Option(name = "--allow-override", metaVar = "SERVICE", usage = "configure the service in daemon.servicename", multiValued = true) @Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true)
final List<String> canOverride = new ArrayList<String>(); final List<String> canOverride = new ArrayList<String>();
@Option(name = "--forbid-override", metaVar = "SERVICE", usage = "configure the service in daemon.servicename", multiValued = true) @Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true)
final List<String> forbidOverride = new ArrayList<String>(); final List<String> forbidOverride = new ArrayList<String>();
@Option(name = "--export-all", usage = "export without git-daemon-export-ok") @Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk")
boolean exportAll; boolean exportAll;
@Argument(required = true, metaVar = "DIRECTORY", usage = "directories to export") @Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport")
final List<File> directory = new ArrayList<File>(); final List<File> directory = new ArrayList<File>();
@Override @Override
@ -108,18 +109,18 @@ class Daemon extends TextBuiltin {
service(d, n).setOverridable(false); service(d, n).setOverridable(false);
for (final File f : directory) { for (final File f : directory) {
out.println("Exporting " + f.getAbsolutePath()); out.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath()));
d.exportDirectory(f); d.exportDirectory(f);
} }
d.start(); d.start();
out.println("Listening on " + d.getAddress()); out.println(MessageFormat.format(CLIText.get().listeningOn, d.getAddress()));
} }
private DaemonService service(final org.eclipse.jgit.transport.Daemon d, private DaemonService service(final org.eclipse.jgit.transport.Daemon d,
final String n) { final String n) {
final DaemonService svc = d.getService(n); final DaemonService svc = d.getService(n);
if (svc == null) if (svc == null)
throw die("Service '" + n + "' not supported"); throw die(MessageFormat.format(CLIText.get().serviceNotSupported, n));
return svc; return svc;
} }
} }

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

@ -64,17 +64,17 @@ import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.AndTreeFilter; import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.eclipse.jgit.treewalk.filter.TreeFilter;
@Command(common = true, usage = "Show diffs") @Command(common = true, usage = "usage_ShowDiffs")
class Diff extends TextBuiltin { class Diff extends TextBuiltin {
@Argument(index = 0, metaVar = "tree-ish", required = true) @Argument(index = 0, metaVar = "metaVar_treeish", required = true)
void tree_0(final AbstractTreeIterator c) { void tree_0(final AbstractTreeIterator c) {
trees.add(c); trees.add(c);
} }
@Argument(index = 1, metaVar = "tree-ish", required = true) @Argument(index = 1, metaVar = "metaVar_treeish", required = true)
private final List<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>(); private final List<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>();
@Option(name = "--", metaVar = "path", multiValued = true, handler = PathTreeFilterHandler.class) @Option(name = "--", metaVar = "metaVar_port", multiValued = true, handler = PathTreeFilterHandler.class)
private TreeFilter pathFilter = TreeFilter.ALL; private TreeFilter pathFilter = TreeFilter.ALL;
private DiffFormatter fmt = new DiffFormatter(); private DiffFormatter fmt = new DiffFormatter();

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

@ -57,18 +57,18 @@ import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.eclipse.jgit.treewalk.filter.TreeFilter;
class DiffTree extends TextBuiltin { class DiffTree extends TextBuiltin {
@Option(name = "--recursive", usage = "recurse into subtrees", aliases = { "-r" }) @Option(name = "--recursive", usage = "usage_recurseIntoSubtrees", aliases = { "-r" })
private boolean recursive; private boolean recursive;
@Argument(index = 0, metaVar = "tree-ish", required = true) @Argument(index = 0, metaVar = "metaVar_treeish", required = true)
void tree_0(final AbstractTreeIterator c) { void tree_0(final AbstractTreeIterator c) {
trees.add(c); trees.add(c);
} }
@Argument(index = 1, metaVar = "tree-ish", required = true) @Argument(index = 1, metaVar = "metaVar_treeish", required = true)
private final List<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>(); private final List<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>();
@Option(name = "--", metaVar = "path", multiValued = true, handler = PathTreeFilterHandler.class) @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
private TreeFilter pathFilter = TreeFilter.ALL; private TreeFilter pathFilter = TreeFilter.ALL;
@Override @Override

14
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java

@ -55,12 +55,12 @@ import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
@Command(common = true, usage = "Update remote refs from another repository") @Command(common = true, usage = "usage_updateRemoteRefsFromAnotherRepository")
class Fetch extends AbstractFetchCommand { class Fetch extends AbstractFetchCommand {
@Option(name = "--timeout", metaVar = "SECONDS", usage = "abort connection if no activity") @Option(name = "--timeout", metaVar = "metaVar_seconds", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1; int timeout = -1;
@Option(name = "--fsck", usage = "perform fsck style checks on receive") @Option(name = "--fsck", usage = "usage_performFsckStyleChecksOnReceive")
private Boolean fsck; private Boolean fsck;
@Option(name = "--no-fsck") @Option(name = "--no-fsck")
@ -68,13 +68,13 @@ class Fetch extends AbstractFetchCommand {
fsck = Boolean.FALSE; fsck = Boolean.FALSE;
} }
@Option(name = "--prune", usage = "prune stale tracking refs") @Option(name = "--prune", usage = "usage_pruneStaleTrackingRefs")
private Boolean prune; private Boolean prune;
@Option(name = "--dry-run") @Option(name = "--dry-run")
private boolean dryRun; private boolean dryRun;
@Option(name = "--thin", usage = "fetch thin pack") @Option(name = "--thin", usage = "usage_fetchThinPack")
private Boolean thin; private Boolean thin;
@Option(name = "--no-thin") @Option(name = "--no-thin")
@ -82,10 +82,10 @@ class Fetch extends AbstractFetchCommand {
thin = Boolean.FALSE; thin = Boolean.FALSE;
} }
@Argument(index = 0, metaVar = "uri-ish") @Argument(index = 0, metaVar = "metaVar_uriish")
private String remote = Constants.DEFAULT_REMOTE_NAME; private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "refspec") @Argument(index = 1, metaVar = "metaVar_refspec")
private List<RefSpec> toget; private List<RefSpec> toget;
@Override @Override

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

@ -84,7 +84,7 @@ class Glog extends RevWalkTextBuiltin {
final JPanel buttons = new JPanel(new FlowLayout()); final JPanel buttons = new JPanel(new FlowLayout());
final JButton repaint = new JButton(); final JButton repaint = new JButton();
repaint.setText("Repaint"); repaint.setText(CLIText.get().repaint);
repaint.addActionListener(new ActionListener() { repaint.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
graphPane.repaint(); graphPane.repaint();
@ -118,7 +118,7 @@ class Glog extends RevWalkTextBuiltin {
@Override @Override
protected RevWalk createWalk() { protected RevWalk createWalk() {
if (objects) if (objects)
throw die("Cannot use --objects with glog"); throw die(CLIText.get().cannotUseObjectsWithGlog);
final PlotWalk w = new PlotWalk(db); final PlotWalk w = new PlotWalk(db);
w.sort(RevSort.BOUNDARY, true); w.sort(RevSort.BOUNDARY, true);
return w; return w;

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

@ -52,13 +52,13 @@ import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.TextProgressMonitor; import org.eclipse.jgit.lib.TextProgressMonitor;
class IndexPack extends TextBuiltin { class IndexPack extends TextBuiltin {
@Option(name = "--fix-thin", usage = "fix a thin pack to be complete") @Option(name = "--fix-thin", usage = "usage_fixAThinPackToBeComplete")
private boolean fixThin; private boolean fixThin;
@Option(name = "--index-version", usage = "index file format to create") @Option(name = "--index-version", usage = "usage_indexFileFormatToCreate")
private int indexVersion = -1; private int indexVersion = -1;
@Argument(index = 0, required = true, metaVar = "base") @Argument(index = 0, required = true, metaVar = "metaVar_base")
private File base; private File base;
@Override @Override

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

@ -46,14 +46,15 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.File; import java.io.File;
import java.text.MessageFormat;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
@Command(common = true, usage = "Create an empty git repository") @Command(common = true, usage = "usage_CreateAnEmptyGitRepository")
class Init extends TextBuiltin { class Init extends TextBuiltin {
@Option(name = "--bare", usage = "Create a bare repository") @Option(name = "--bare", usage = "usage_CreateABareRepository")
private boolean bare; private boolean bare;
@Override @Override
@ -67,7 +68,6 @@ class Init extends TextBuiltin {
gitdir = new File(bare ? "." : Constants.DOT_GIT); gitdir = new File(bare ? "." : Constants.DOT_GIT);
db = new Repository(gitdir); db = new Repository(gitdir);
db.create(bare); db.create(bare);
out.println("Initialized empty Git repository in " out.println(MessageFormat.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath()));
+ gitdir.getAbsolutePath());
} }
} }

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

@ -46,6 +46,7 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.MessageFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
@ -61,7 +62,7 @@ import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.revwalk.RevWalk;
@Command(common = true, usage = "View commit history") @Command(common = true, usage = "usage_viewCommitHistory")
class Log extends RevWalkTextBuiltin { class Log extends RevWalkTextBuiltin {
private final TimeZone myTZ = TimeZone.getDefault(); private final TimeZone myTZ = TimeZone.getDefault();
@ -69,7 +70,7 @@ class Log extends RevWalkTextBuiltin {
private Map<AnyObjectId, Set<Ref>> allRefsByPeeledObjectId; private Map<AnyObjectId, Set<Ref>> allRefsByPeeledObjectId;
@Option(name="--decorate", usage="Show ref names matching commits") @Option(name="--decorate", usage="usage_showRefNamesMatchingCommits")
private boolean decorate; private boolean decorate;
Log() { Log() {
@ -86,7 +87,8 @@ class Log extends RevWalkTextBuiltin {
@Override @Override
protected void show(final RevCommit c) throws Exception { protected void show(final RevCommit c) throws Exception {
out.print("commit "); out.print(CLIText.get().commitLabel);
out.print(" ");
c.getId().copyTo(outbuffer, out); c.getId().copyTo(outbuffer, out);
if (decorate) { if (decorate) {
Collection<Ref> list = allRefsByPeeledObjectId.get(c.copy()); Collection<Ref> list = allRefsByPeeledObjectId.get(c.copy());
@ -103,18 +105,11 @@ class Log extends RevWalkTextBuiltin {
out.println(); out.println();
final PersonIdent author = c.getAuthorIdent(); final PersonIdent author = c.getAuthorIdent();
out.print("Author: "); out.println(MessageFormat.format(CLIText.get().authorInfo, author.getName(), author.getEmailAddress()));
out.print(author.getName());
out.print(" <");
out.print(author.getEmailAddress());
out.print(">");
out.println();
final TimeZone authorTZ = author.getTimeZone(); final TimeZone authorTZ = author.getTimeZone();
fmt.setTimeZone(authorTZ != null ? authorTZ : myTZ); fmt.setTimeZone(authorTZ != null ? authorTZ : myTZ);
out.print("Date: "); out.println(MessageFormat.format(CLIText.get().dateInfo, fmt.format(author.getWhen())));
out.print(fmt.format(author.getWhen()));
out.println();
out.println(); out.println();
final String[] lines = c.getFullMessage().split("\n"); final String[] lines = c.getFullMessage().split("\n");

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

@ -53,10 +53,10 @@ import org.eclipse.jgit.transport.FetchConnection;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
class LsRemote extends TextBuiltin { class LsRemote extends TextBuiltin {
@Option(name = "--timeout", metaVar = "SECONDS", usage = "abort connection if no activity") @Option(name = "--timeout", metaVar = "metaVar_service", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1; int timeout = -1;
@Argument(index = 0, metaVar = "uri-ish", required = true) @Argument(index = 0, metaVar = "metaVar_uriish", required = true)
private String remote; private String remote;
@Override @Override

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java

@ -53,10 +53,10 @@ import org.eclipse.jgit.treewalk.AbstractTreeIterator;
import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.TreeWalk;
class LsTree extends TextBuiltin { class LsTree extends TextBuiltin {
@Option(name = "--recursive", usage = "recurse into subtrees", aliases = { "-r" }) @Option(name = "--recursive", usage = "usage_recurseIntoSubtrees", aliases = { "-r" })
private boolean recursive; private boolean recursive;
@Argument(index = 0, required = true, metaVar = "tree-ish") @Argument(index = 0, required = true, metaVar = "metaVar_treeish")
private AbstractTreeIterator tree; private AbstractTreeIterator tree;
@Override @Override

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

@ -45,9 +45,11 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.File; import java.io.File;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@ -70,19 +72,19 @@ import org.kohsuke.args4j.Option;
/** Command line entry point. */ /** Command line entry point. */
public class Main { public class Main {
@Option(name = "--help", usage = "display this help text", aliases = { "-h" }) @Option(name = "--help", usage = "usage_displayThisHelpText", aliases = { "-h" })
private boolean help; private boolean help;
@Option(name = "--show-stack-trace", usage = "display the Java stack trace on exceptions") @Option(name = "--show-stack-trace", usage = "usage_displayThejavaStackTraceOnExceptions")
private boolean showStackTrace; private boolean showStackTrace;
@Option(name = "--git-dir", metaVar = "GIT_DIR", usage = "set the git repository to operate on") @Option(name = "--git-dir", metaVar = "metaVar_gitDir", usage = "usage_setTheGitRepositoryToOperateOn")
private File gitdir; private File gitdir;
@Argument(index = 0, metaVar = "command", required = true, handler = SubcommandHandler.class) @Argument(index = 0, metaVar = "metaVar_command", required = true, handler = SubcommandHandler.class)
private TextBuiltin subcommand; private TextBuiltin subcommand;
@Argument(index = 1, metaVar = "ARG") @Argument(index = 1, metaVar = "metaVar_arg")
private List<String> arguments = new ArrayList<String>(); private List<String> arguments = new ArrayList<String>();
/** /**
@ -101,17 +103,17 @@ public class Main {
configureHttpProxy(); configureHttpProxy();
me.execute(argv); me.execute(argv);
} catch (Die err) { } catch (Die err) {
System.err.println("fatal: " + err.getMessage()); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
if (me.showStackTrace) if (me.showStackTrace)
err.printStackTrace(); err.printStackTrace();
System.exit(128); System.exit(128);
} catch (Exception err) { } catch (Exception err) {
if (!me.showStackTrace && err.getCause() != null if (!me.showStackTrace && err.getCause() != null
&& err instanceof TransportException) && err instanceof TransportException)
System.err.println("fatal: " + err.getCause().getMessage()); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage()));
if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) {
System.err.println("fatal: " + err.getMessage()); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
if (me.showStackTrace) if (me.showStackTrace)
err.printStackTrace(); err.printStackTrace();
System.exit(128); System.exit(128);
@ -123,25 +125,27 @@ public class Main {
private void execute(final String[] argv) throws Exception { private void execute(final String[] argv) throws Exception {
final CmdLineParser clp = new CmdLineParser(this); final CmdLineParser clp = new CmdLineParser(this);
PrintWriter writer = new PrintWriter(System.err);
try { try {
clp.parseArgument(argv); clp.parseArgument(argv);
} catch (CmdLineException err) { } catch (CmdLineException err) {
if (argv.length > 0 && !help) { if (argv.length > 0 && !help) {
System.err.println("fatal: " + err.getMessage()); writer.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
writer.flush();
System.exit(1); System.exit(1);
} }
} }
if (argv.length == 0 || help) { if (argv.length == 0 || help) {
final String ex = clp.printExample(ExampleMode.ALL); final String ex = clp.printExample(ExampleMode.ALL, CLIText.get().resourceBundle());
System.err.println("jgit" + ex + " command [ARG ...]"); writer.println("jgit" + ex + " command [ARG ...]");
if (help) { if (help) {
System.err.println(); writer.println();
clp.printUsage(System.err); clp.printUsage(writer, CLIText.get().resourceBundle());
System.err.println(); writer.println();
} else if (subcommand == null) { } else if (subcommand == null) {
System.err.println(); writer.println();
System.err.println("The most commonly used commands are:"); writer.println(CLIText.get().mostCommonlyUsedCommandsAre);
final CommandRef[] common = CommandCatalog.common(); final CommandRef[] common = CommandCatalog.common();
int width = 0; int width = 0;
for (final CommandRef c : common) for (final CommandRef c : common)
@ -149,15 +153,16 @@ public class Main {
width += 2; width += 2;
for (final CommandRef c : common) { for (final CommandRef c : common) {
System.err.print(' '); writer.print(' ');
System.err.print(c.getName()); writer.print(c.getName());
for (int i = c.getName().length(); i < width; i++) for (int i = c.getName().length(); i < width; i++)
System.err.print(' '); writer.print(' ');
System.err.print(c.getUsage()); writer.print(CLIText.get().resourceBundle().getString(c.getUsage()));
System.err.println(); writer.println();
} }
System.err.println(); writer.println();
} }
writer.flush();
System.exit(1); System.exit(1);
} }
@ -203,7 +208,8 @@ public class Main {
altobjectdirs = null; altobjectdirs = null;
if (gitdir == null || !gitdir.isDirectory()) { if (gitdir == null || !gitdir.isDirectory()) {
System.err.println("error: can't find git directory"); writer.println(CLIText.get().cantFindGitDirectory);
writer.flush();
System.exit(1); System.exit(1);
} }
cmd.init(new Repository(gitdir, gitworktree, objectdir, altobjectdirs, indexfile), gitdir); cmd.init(new Repository(gitdir, gitworktree, objectdir, altobjectdirs, indexfile), gitdir);
@ -252,15 +258,15 @@ public class Main {
return false; return false;
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new RuntimeException("Cannot setup console", e); throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
} catch (SecurityException e) { } catch (SecurityException e) {
throw new RuntimeException("Cannot setup console", e); throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new RuntimeException("Cannot setup console", e); throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
throw new RuntimeException("Cannot setup console", e); throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new RuntimeException("Cannot setup console", e); throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
} }
} }
@ -297,8 +303,7 @@ public class Main {
final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s);
if (!"http".equals(u.getProtocol())) if (!"http".equals(u.getProtocol()))
throw new MalformedURLException("Invalid http_proxy: " + s throw new MalformedURLException(MessageFormat.format(CLIText.get().invalidHttpProxyOnlyHttpSupported, s));
+ ": Only http supported.");
final String proxyHost = u.getHost(); final String proxyHost = u.getHost();
final int proxyPort = u.getPort(); final int proxyPort = u.getPort();

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

@ -53,15 +53,15 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.filter.RevFilter; import org.eclipse.jgit.revwalk.filter.RevFilter;
class MergeBase extends TextBuiltin { class MergeBase extends TextBuiltin {
@Option(name = "--all", usage = "display all possible merge bases") @Option(name = "--all", usage = "usage_displayAllPossibleMergeBases")
private boolean all; private boolean all;
@Argument(index = 0, metaVar = "commit-ish", required = true) @Argument(index = 0, metaVar = "metaVar_commitish", required = true)
void commit_0(final RevCommit c) { void commit_0(final RevCommit c) {
commits.add(c); commits.add(c);
} }
@Argument(index = 1, metaVar = "commit-ish", required = true) @Argument(index = 1, metaVar = "metaVar_commitish", required = true)
private final List<RevCommit> commits = new ArrayList<RevCommit>(); private final List<RevCommit> commits = new ArrayList<RevCommit>();
@Override @Override

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

@ -43,6 +43,7 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -59,15 +60,15 @@ import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.RemoteRefUpdate.Status; import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
@Command(common = true, usage = "Update remote repository from local refs") @Command(common = true, usage = "usage_UpdateRemoteRepositoryFromLocalRefs")
class Push extends TextBuiltin { class Push extends TextBuiltin {
@Option(name = "--timeout", metaVar = "SECONDS", usage = "abort connection if no activity") @Option(name = "--timeout", metaVar = "metaVar_seconds", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1; int timeout = -1;
@Argument(index = 0, metaVar = "uri-ish") @Argument(index = 0, metaVar = "metaVar_uriish")
private String remote = Constants.DEFAULT_REMOTE_NAME; private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "refspec") @Argument(index = 1, metaVar = "metaVar_refspec")
private final List<RefSpec> refSpecs = new ArrayList<RefSpec>(); private final List<RefSpec> refSpecs = new ArrayList<RefSpec>();
@Option(name = "--all") @Option(name = "--all")
@ -94,7 +95,7 @@ class Push extends TextBuiltin {
@Option(name = "--force", aliases = { "-f" }) @Option(name = "--force", aliases = { "-f" })
private boolean force; private boolean force;
@Option(name = "--receive-pack", metaVar = "path") @Option(name = "--receive-pack", metaVar = "metaVar_path")
private String receivePack; private String receivePack;
@Option(name = "--dry-run") @Option(name = "--dry-run")
@ -164,14 +165,14 @@ class Push extends TextBuiltin {
AbstractFetchCommand.showRemoteMessages(result.getMessages()); AbstractFetchCommand.showRemoteMessages(result.getMessages());
if (everythingUpToDate) if (everythingUpToDate)
out.println("Everything up-to-date"); out.println(CLIText.get().everythingUpToDate);
} }
private void printRefUpdateResult(final URIish uri, private void printRefUpdateResult(final URIish uri,
final PushResult result, final RemoteRefUpdate rru) { final PushResult result, final RemoteRefUpdate rru) {
if (!shownURI) { if (!shownURI) {
shownURI = true; shownURI = true;
out.format("To %s\n", uri); out.println(MessageFormat.format(CLIText.get().pushTo, uri));
} }
final String remoteName = rru.getRemoteName(); final String remoteName = rru.getRemoteName();
@ -197,7 +198,7 @@ class Push extends TextBuiltin {
.name() .name()
+ (fastForward ? ".." : "...") + (fastForward ? ".." : "...")
+ rru.getNewObjectId().abbreviate(db).name(); + rru.getNewObjectId().abbreviate(db).name();
final String message = fastForward ? null : "forced update"; final String message = fastForward ? null : CLIText.get().forcedUpdate;
printUpdateLine(flag, summary, srcRef, remoteName, message); printUpdateLine(flag, summary, srcRef, remoteName, message);
} }
} }
@ -209,17 +210,18 @@ class Push extends TextBuiltin {
case REJECTED_NODELETE: case REJECTED_NODELETE:
printUpdateLine('!', "[rejected]", null, remoteName, printUpdateLine('!', "[rejected]", null, remoteName,
"remote side does not support deleting refs"); CLIText.get().remoteSideDoesNotSupportDeletingRefs);
break; break;
case REJECTED_NONFASTFORWARD: case REJECTED_NONFASTFORWARD:
printUpdateLine('!', "[rejected]", srcRef, remoteName, printUpdateLine('!', "[rejected]", srcRef, remoteName,
"non-fast forward"); CLIText.get().nonFastForward);
break; break;
case REJECTED_REMOTE_CHANGED: case REJECTED_REMOTE_CHANGED:
final String message = "remote ref object changed - is not expected one " final String message = MessageFormat.format(
+ rru.getExpectedOldObjectId().abbreviate(db).name(); CLIText.get().remoteRefObjectChangedIsNotExpectedOne
, rru.getExpectedOldObjectId().abbreviate(db).name());
printUpdateLine('!', "[rejected]", srcRef, remoteName, message); printUpdateLine('!', "[rejected]", srcRef, remoteName, message);
break; break;

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

@ -45,14 +45,15 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.File; import java.io.File;
import java.text.MessageFormat;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
@Command(common = false, usage = "Server side backend for 'jgit push'") @Command(common = false, usage = "usage_ServerSideBackendForJgitPush")
class ReceivePack extends TextBuiltin { class ReceivePack extends TextBuiltin {
@Argument(index = 0, required = true, metaVar = "DIRECTORY", usage = "Repository to receive into") @Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReceiveInto")
File dstGitdir; File dstGitdir;
@Override @Override
@ -68,7 +69,7 @@ class ReceivePack extends TextBuiltin {
dstGitdir = new File(dstGitdir, Constants.DOT_GIT); dstGitdir = new File(dstGitdir, Constants.DOT_GIT);
db = new Repository(dstGitdir); db = new Repository(dstGitdir);
if (!db.getObjectsDirectory().isDirectory()) if (!db.getObjectsDirectory().isDirectory())
throw die("'" + dstGitdir.getPath() + "' not a git repository"); throw die(MessageFormat.format(CLIText.get().notAGitRepository, dstGitdir.getPath()));
rp = new org.eclipse.jgit.transport.ReceivePack(db); rp = new org.eclipse.jgit.transport.ReceivePack(db);
rp.receive(System.in, System.out, System.err); rp.receive(System.in, System.out, System.err);
} }

12
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java

@ -43,6 +43,7 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@ -109,10 +110,10 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
enableRevSort(RevSort.BOUNDARY, on); enableRevSort(RevSort.BOUNDARY, on);
} }
@Argument(index = 0, metaVar = "commit-ish") @Argument(index = 0, metaVar = "metaVar_commitish")
private final List<RevCommit> commits = new ArrayList<RevCommit>(); private final List<RevCommit> commits = new ArrayList<RevCommit>();
@Option(name = "--", metaVar = "path", multiValued = true, handler = PathTreeFilterHandler.class) @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
private TreeFilter pathFilter = TreeFilter.ALL; private TreeFilter pathFilter = TreeFilter.ALL;
private final List<RevFilter> revLimiter = new ArrayList<RevFilter>(); private final List<RevFilter> revLimiter = new ArrayList<RevFilter>();
@ -150,7 +151,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
if (commits.isEmpty()) { if (commits.isEmpty()) {
final ObjectId head = db.resolve(Constants.HEAD); final ObjectId head = db.resolve(Constants.HEAD);
if (head == null) if (head == null)
throw die("Cannot resolve " + Constants.HEAD); throw die(MessageFormat.format(CLIText.get().cannotResolve, Constants.HEAD));
commits.add(walk.parseCommit(head)); commits.add(walk.parseCommit(head));
} }
for (final RevCommit c : commits) { for (final RevCommit c : commits) {
@ -167,9 +168,8 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
final long end = System.currentTimeMillis(); final long end = System.currentTimeMillis();
System.err.print(n); System.err.print(n);
System.err.print(' '); System.err.print(' ');
System.err.print(end - start); System.err.println(MessageFormat.format(
System.err.print(" ms"); CLIText.get().timeInMilliSeconds, end - start));
System.err.println();
} }
} }

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java

@ -57,9 +57,9 @@ import org.eclipse.jgit.pgm.opt.PathTreeFilterHandler;
import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.eclipse.jgit.treewalk.filter.TreeFilter;
@Command(usage = "Stop tracking a file", common = true) @Command(usage = "usage_StopTrackingAFile", common = true)
class Rm extends TextBuiltin { class Rm extends TextBuiltin {
@Argument(metaVar = "path", usage = "path", multiValued = true, required = true, handler = PathTreeFilterHandler.class) @Argument(metaVar = "metaVar_path", usage = "usage_path", multiValued = true, required = true, handler = PathTreeFilterHandler.class)
@Option(name = "--", handler = StopOptionHandler.class) @Option(name = "--", handler = StopOptionHandler.class)
private TreeFilter paths; private TreeFilter paths;

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

@ -47,6 +47,8 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.text.MessageFormat;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.MissingObjectException;
@ -55,18 +57,18 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader; import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.PersonIdent;
@Command(common = true, usage = "Create a tag") @Command(common = true, usage = "usage_CreateATag")
class Tag extends TextBuiltin { class Tag extends TextBuiltin {
@Option(name = "-f", usage = "force replacing an existing tag") @Option(name = "-f", usage = "usage_forceReplacingAnExistingTag")
private boolean force; private boolean force;
@Option(name = "-m", metaVar = "message", usage = "tag message") @Option(name = "-m", metaVar = "metaVar_message", usage = "usage_tagMessage")
private String message = ""; private String message = "";
@Argument(index = 0, required = true, metaVar = "name") @Argument(index = 0, required = true, metaVar = "metaVar_name")
private String tagName; private String tagName;
@Argument(index = 1, metaVar = "object") @Argument(index = 1, metaVar = "metaVar_object")
private ObjectId object; private ObjectId object;
@Override @Override
@ -74,15 +76,14 @@ class Tag extends TextBuiltin {
if (object == null) { if (object == null) {
object = db.resolve(Constants.HEAD); object = db.resolve(Constants.HEAD);
if (object == null) if (object == null)
throw die("Cannot resolve " + Constants.HEAD); throw die(MessageFormat.format(CLIText.get().cannotResolve, Constants.HEAD));
} }
if (!tagName.startsWith(Constants.R_TAGS)) if (!tagName.startsWith(Constants.R_TAGS))
tagName = Constants.R_TAGS + tagName; tagName = Constants.R_TAGS + tagName;
if (!force && db.resolve(tagName) != null) { if (!force && db.resolve(tagName) != null) {
throw die("fatal: tag '" throw die(MessageFormat.format(CLIText.get().fatalErrorTagExists
+ tagName.substring(Constants.R_TAGS.length()) , tagName.substring(Constants.R_TAGS.length())));
+ "' exists");
} }
final ObjectLoader ldr = db.openObject(object); final ObjectLoader ldr = db.openObject(object);

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

@ -53,6 +53,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
@ -75,7 +77,7 @@ import org.eclipse.jgit.revwalk.RevWalk;
public abstract class TextBuiltin { public abstract class TextBuiltin {
private String commandName; private String commandName;
@Option(name = "--help", usage = "display this help text", aliases = { "-h" }) @Option(name = "--help", usage = "usage_displayThisHelpText", aliases = { "-h" })
private boolean help; private boolean help;
/** Stream to output to, typically this is standard output. */ /** Stream to output to, typically this is standard output. */
@ -110,7 +112,7 @@ public abstract class TextBuiltin {
out = new PrintWriter(new BufferedWriter( out = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(System.out))); new OutputStreamWriter(System.out)));
} catch (IOException e) { } catch (IOException e) {
throw die("cannot create output stream"); throw die(CLIText.get().cannotCreateOutputStream);
} }
if (repo != null) { if (repo != null) {
@ -153,7 +155,7 @@ public abstract class TextBuiltin {
clp.parseArgument(args); clp.parseArgument(args);
} catch (CmdLineException err) { } catch (CmdLineException err) {
if (!help) { if (!help) {
System.err.println("fatal: " + err.getMessage()); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
System.exit(1); System.exit(1);
} }
} }
@ -181,19 +183,29 @@ public abstract class TextBuiltin {
* @param clp * @param clp
*/ */
public void printUsageAndExit(final String message, final CmdLineParser clp) { public void printUsageAndExit(final String message, final CmdLineParser clp) {
System.err.println(message); PrintWriter writer = new PrintWriter(System.err);
System.err.print("jgit "); writer.println(message);
System.err.print(commandName); writer.print("jgit ");
clp.printSingleLineUsage(System.err); writer.print(commandName);
System.err.println(); clp.printSingleLineUsage(writer, getResourceBundle());
writer.println();
System.err.println(); writer.println();
clp.printUsage(System.err); clp.printUsage(writer, getResourceBundle());
System.err.println(); writer.println();
writer.flush();
System.exit(1); System.exit(1);
} }
/**
* @return the resource bundle that will be passed to args4j for purpose
* of string localization
*/
protected ResourceBundle getResourceBundle() {
return CLIText.get().resourceBundle();
}
/** /**
* Perform the actions of this command. * Perform the actions of this command.
* <p> * <p>
@ -216,7 +228,7 @@ public abstract class TextBuiltin {
ObjectId resolve(final String s) throws IOException { ObjectId resolve(final String s) throws IOException {
final ObjectId r = db.resolve(s); final ObjectId r = db.resolve(s);
if (r == null) if (r == null)
throw die("Not a revision: " + s); throw die(MessageFormat.format(CLIText.get().notARevision, s));
return r; return r;
} }

9
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java

@ -45,18 +45,19 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.File; import java.io.File;
import java.text.MessageFormat;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
@Command(common = false, usage = "Server side backend for 'jgit fetch'") @Command(common = false, usage = "usage_ServerSideBackendForJgitFetch")
class UploadPack extends TextBuiltin { class UploadPack extends TextBuiltin {
@Option(name = "--timeout", metaVar = "SECONDS", usage = "abort connection if no activity") @Option(name = "--timeout", metaVar = "metaVar_seconds", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1; int timeout = -1;
@Argument(index = 0, required = true, metaVar = "DIRECTORY", usage = "Repository to read from") @Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReadFrom")
File srcGitdir; File srcGitdir;
@Override @Override
@ -72,7 +73,7 @@ class UploadPack extends TextBuiltin {
srcGitdir = new File(srcGitdir, Constants.DOT_GIT); srcGitdir = new File(srcGitdir, Constants.DOT_GIT);
db = new Repository(srcGitdir); db = new Repository(srcGitdir);
if (!db.getObjectsDirectory().isDirectory()) if (!db.getObjectsDirectory().isDirectory())
throw die("'" + srcGitdir.getPath() + "' not a git repository"); throw die(MessageFormat.format(CLIText.get().notAGitRepository, srcGitdir.getPath()));
rp = new org.eclipse.jgit.transport.UploadPack(db); rp = new org.eclipse.jgit.transport.UploadPack(db);
if (0 <= timeout) if (0 <= timeout)
rp.setTimeout(timeout); rp.setTimeout(timeout);

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

@ -43,16 +43,16 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
@Command(common = true, usage = "Display the version of jgit") import java.text.MessageFormat;
@Command(common = true, usage = "usage_DisplayTheVersionOfJgit")
class Version extends TextBuiltin { class Version extends TextBuiltin {
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final Package pkg = getClass().getPackage(); final Package pkg = getClass().getPackage();
if (pkg == null || pkg.getImplementationVersion() == null) if (pkg == null || pkg.getImplementationVersion() == null)
throw die("Cannot read package information."); throw die(CLIText.get().cannotReadPackageInformation);
out.print("jgit version "); out.println(MessageFormat.format(CLIText.get().jgitVersion, pkg.getImplementationVersion()));
out.print(pkg.getImplementationVersion());
out.println();
} }
} }

15
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java

@ -44,8 +44,11 @@
package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;
import java.text.MessageFormat;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheTree; import org.eclipse.jgit.dircache.DirCacheTree;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
class MakeCacheTree extends TextBuiltin { class MakeCacheTree extends TextBuiltin {
@ -57,16 +60,8 @@ class MakeCacheTree extends TextBuiltin {
} }
private void show(final DirCacheTree tree) { private void show(final DirCacheTree tree) {
out.print("\""); out.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
out.print(tree.getPathString()); , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
out.print("\"");
out.print(": ");
out.print(tree.getEntrySpan());
out.print(" entries");
out.print(", ");
out.print(tree.getChildCount());
out.print(" children");
out.println();
for (int i = 0; i < tree.getChildCount(); i++) for (int i = 0; i < tree.getChildCount(); i++)
show(tree.getChild(i)); show(tree.getChild(i));

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

@ -44,7 +44,10 @@
package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;
import java.text.MessageFormat;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
class ReadDirCache extends TextBuiltin { class ReadDirCache extends TextBuiltin {
@ -55,6 +58,7 @@ class ReadDirCache extends TextBuiltin {
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
DirCache.read(db); DirCache.read(db);
final long end = System.currentTimeMillis(); final long end = System.currentTimeMillis();
out.println(" average " + ((end - start) / cnt) + " ms/read"); out.print(" ");
out.println(MessageFormat.format(CLIText.get().averageMSPerRead, (end - start) / cnt));
} }
} }

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

@ -48,6 +48,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -72,6 +73,7 @@ import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.RefWriter; import org.eclipse.jgit.lib.RefWriter;
import org.eclipse.jgit.lib.TextProgressMonitor; import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.lib.Tree; import org.eclipse.jgit.lib.Tree;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.revwalk.RevWalk;
@ -96,13 +98,13 @@ import org.eclipse.jgit.revwalk.RevWalk;
class RebuildCommitGraph extends TextBuiltin { class RebuildCommitGraph extends TextBuiltin {
private final String REALLY = "--destroy-this-repository"; private final String REALLY = "--destroy-this-repository";
@Option(name = REALLY, usage = "approve destruction of repository") @Option(name = REALLY, usage = "usage_approveDestructionOfRepository")
boolean really; boolean really;
@Argument(index = 0, required = true, metaVar = "REFS", usage = "for-each-ref output") @Argument(index = 0, required = true, metaVar = "metaVar_refs", usage = "usage_forEachRefOutput")
File refList; File refList;
@Argument(index = 1, required = true, metaVar = "DAG", usage = "log --all '--pretty=format:%H %ct %P' output") @Argument(index = 1, required = true, metaVar = "metaVar_refs", usage = "usage_logAllPretty")
File graph; File graph;
private final ProgressMonitor pm = new TextProgressMonitor(); private final ProgressMonitor pm = new TextProgressMonitor();
@ -112,28 +114,15 @@ class RebuildCommitGraph extends TextBuiltin {
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (!really && !db.getAllRefs().isEmpty()) { if (!really && !db.getAllRefs().isEmpty()) {
final StringBuilder m = new StringBuilder(); System.err.println(
m.append("fatal: "); MessageFormat.format(CLIText.get().fatalThisProgramWillDestroyTheRepository
m.append("This program will destroy the repository:"); , db.getDirectory().getAbsolutePath(), REALLY));
m.append("\n"); throw die(CLIText.get().needApprovalToDestroyCurrentRepository);
m.append("fatal:\n");
m.append("fatal: ");
m.append(db.getDirectory().getAbsolutePath());
m.append("\n");
m.append("fatal:\n");
m.append("fatal: ");
m.append("To continue, add ");
m.append(REALLY);
m.append(" to the command line");
m.append("\n");
m.append("fatal:");
System.err.println(m);
throw die("Need approval to destroy current repository");
} }
if (!refList.isFile()) if (!refList.isFile())
throw die("no such file: " + refList.getPath()); throw die(MessageFormat.format(CLIText.get().noSuchFile, refList.getPath()));
if (!graph.isFile()) if (!graph.isFile())
throw die("no such file: " + graph.getPath()); throw die(MessageFormat.format(CLIText.get().noSuchFile, graph.getPath()));
recreateCommitGraph(); recreateCommitGraph();
detachHead(); detachHead();
@ -240,10 +229,10 @@ class RebuildCommitGraph extends TextBuiltin {
final LockFile lf; final LockFile lf;
lf = new LockFile(new File(db.getDirectory(), Constants.HEAD)); lf = new LockFile(new File(db.getDirectory(), Constants.HEAD));
if (!lf.lock()) if (!lf.lock())
throw new IOException("Cannot lock HEAD"); throw new IOException(MessageFormat.format(CLIText.get().cannotLock, Constants.HEAD));
lf.write(id); lf.write(id);
if (!lf.commit()) if (!lf.commit())
throw new IOException("Cannot deatch HEAD"); throw new IOException(CLIText.get().cannotDeatchHEAD);
} }
} }
@ -267,14 +256,14 @@ class RebuildCommitGraph extends TextBuiltin {
final File file = new File(db.getDirectory(), name); final File file = new File(db.getDirectory(), name);
final LockFile lck = new LockFile(file); final LockFile lck = new LockFile(file);
if (!lck.lock()) if (!lck.lock())
throw new ObjectWritingException("Can't write " + file); throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
try { try {
lck.write(content); lck.write(content);
} catch (IOException ioe) { } catch (IOException ioe) {
throw new ObjectWritingException("Can't write " + file); throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
} }
if (!lck.commit()) if (!lck.commit())
throw new ObjectWritingException("Can't write " + file); throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file));
} }
}.writePackedRefs(); }.writePackedRefs();
} }
@ -299,7 +288,7 @@ class RebuildCommitGraph extends TextBuiltin {
rw.parseAny(id); rw.parseAny(id);
} catch (MissingObjectException mue) { } catch (MissingObjectException mue) {
if (!Constants.TYPE_COMMIT.equals(type)) { if (!Constants.TYPE_COMMIT.equals(type)) {
System.err.println("skipping " + type + " " + name); System.err.println(MessageFormat.format(CLIText.get().skippingObject, type, name));
continue; continue;
} }
throw new MissingObjectException(id, type); throw new MissingObjectException(id, type);

17
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java

@ -44,8 +44,11 @@
package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;
import java.text.MessageFormat;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheTree; import org.eclipse.jgit.dircache.DirCacheTree;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
class ShowCacheTree extends TextBuiltin { class ShowCacheTree extends TextBuiltin {
@ -54,21 +57,13 @@ class ShowCacheTree extends TextBuiltin {
final DirCache cache = DirCache.read(db); final DirCache cache = DirCache.read(db);
final DirCacheTree tree = cache.getCacheTree(false); final DirCacheTree tree = cache.getCacheTree(false);
if (tree == null) if (tree == null)
throw die("no 'TREE' section in index"); throw die(CLIText.get().noTREESectionInIndex);
show(tree); show(tree);
} }
private void show(final DirCacheTree tree) { private void show(final DirCacheTree tree) {
out.print("\""); out.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
out.print(tree.getPathString()); , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
out.print("\"");
out.print(": ");
out.print(tree.getEntrySpan());
out.print(" entries");
out.print(", ");
out.print(tree.getChildCount());
out.print(" children");
out.println();
for (int i = 0; i < tree.getChildCount(); i++) for (int i = 0; i < tree.getChildCount(); i++)
show(tree.getChild(i)); show(tree.getChild(i));

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

@ -46,14 +46,15 @@ package org.eclipse.jgit.pgm.debug;
import java.net.URL; import java.net.URL;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.Command; import org.eclipse.jgit.pgm.Command;
import org.eclipse.jgit.pgm.CommandCatalog; import org.eclipse.jgit.pgm.CommandCatalog;
import org.eclipse.jgit.pgm.CommandRef; import org.eclipse.jgit.pgm.CommandRef;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
@Command(usage = "Display a list of all registered jgit commands") @Command(usage = "usage_displayAListOfAllRegisteredJgitCommands")
class ShowCommands extends TextBuiltin { class ShowCommands extends TextBuiltin {
@Option(name = "--pretty", usage = "alter the detail shown") @Option(name = "--pretty", usage = "usage_alterTheDetailShown")
private Format pretty = Format.USAGE; private Format pretty = Format.USAGE;
@Override @Override
@ -83,7 +84,9 @@ class ShowCommands extends TextBuiltin {
/** */ /** */
USAGE { USAGE {
void print(final CommandRef c) { void print(final CommandRef c) {
System.err.print(c.getUsage()); String usage = c.getUsage();
if (usage != null && usage.length() > 0)
System.err.print(CLIText.get().resourceBundle().getString(usage));
} }
}, },
@ -104,7 +107,7 @@ class ShowCommands extends TextBuiltin {
final URL url = ldr.getResource(cn); final URL url = ldr.getResource(cn);
if (url == null) { if (url == null) {
System.err.print("!! NOT FOUND !!"); System.err.print(CLIText.get().notFound);
return; return;
} }

5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java

@ -45,6 +45,7 @@
package org.eclipse.jgit.pgm.debug; package org.eclipse.jgit.pgm.debug;
import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
class WriteDirCache extends TextBuiltin { class WriteDirCache extends TextBuiltin {
@ -52,10 +53,10 @@ class WriteDirCache extends TextBuiltin {
protected void run() throws Exception { protected void run() throws Exception {
final DirCache cache = DirCache.read(db); final DirCache cache = DirCache.read(db);
if (!cache.lock()) if (!cache.lock())
throw die("failed to lock index"); throw die(CLIText.get().failedToLockIndex);
cache.read(); cache.read();
cache.write(); cache.write();
if (!cache.commit()) if (!cache.commit())
throw die("failed to commit index"); throw die(CLIText.get().failedToCommitIndex);
} }
} }

20
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java

@ -46,12 +46,14 @@ package org.eclipse.jgit.pgm.eclipse;
import java.io.File; import java.io.File;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.CookieHandler; import java.net.CookieHandler;
import java.text.MessageFormat;
import org.eclipse.jgit.iplog.IpLogGenerator; import org.eclipse.jgit.iplog.IpLogGenerator;
import org.eclipse.jgit.iplog.SimpleCookieManager; import org.eclipse.jgit.iplog.SimpleCookieManager;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.LockFile; import org.eclipse.jgit.lib.LockFile;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.Command; import org.eclipse.jgit.pgm.Command;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
import org.eclipse.jgit.revwalk.RevObject; import org.eclipse.jgit.revwalk.RevObject;
@ -60,15 +62,15 @@ import org.eclipse.jgit.revwalk.RevWalk;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
@Command(name = "eclipse-iplog", common = false, usage = "Produce an Eclipse IP log") @Command(name = "eclipse-iplog", common = false, usage = "usage_produceAnEclipseIPLog")
class Iplog extends TextBuiltin { class Iplog extends TextBuiltin {
@Option(name = "--version", aliases = { "-r" }, metaVar = "VERSION", usage = "Symbolic version for the project") @Option(name = "--version", aliases = { "-r" }, metaVar = "metaVar_version", usage = "usage_symbolicVersionForTheProject")
private String version; private String version;
@Option(name = "--output", aliases = { "-o" }, metaVar = "FILE", usage = "Output file") @Option(name = "--output", aliases = { "-o" }, metaVar = "metaVar_file", usage = "usage_outputFile")
private File output; private File output;
@Argument(index = 0, metaVar = "COMMIT|TAG") @Argument(index = 0, metaVar = "metaVar_commitOrTag")
private ObjectId commitId; private ObjectId commitId;
@Override @Override
@ -79,8 +81,8 @@ class Iplog extends TextBuiltin {
final IpLogGenerator log = new IpLogGenerator(); final IpLogGenerator log = new IpLogGenerator();
if (commitId == null) { if (commitId == null) {
System.err.println("warning: No commit given on command line," System.err.println(MessageFormat.format(
+ " assuming " + Constants.HEAD); CLIText.get().warningNoCommitGivenOnCommandLine, Constants.HEAD));
commitId = db.resolve(Constants.HEAD); commitId = db.resolve(Constants.HEAD);
} }
@ -89,7 +91,7 @@ class Iplog extends TextBuiltin {
if (version == null && start instanceof RevTag) if (version == null && start instanceof RevTag)
version = ((RevTag) start).getTagName(); version = ((RevTag) start).getTagName();
else if (version == null) else if (version == null)
throw die(start.name() + " is not a tag, --version is required"); throw die(MessageFormat.format(CLIText.get().notATagVersionIsRequired, start.name()));
log.scan(db, rw.parseCommit(start), version); log.scan(db, rw.parseCommit(start), version);
@ -98,7 +100,7 @@ class Iplog extends TextBuiltin {
output.getParentFile().mkdirs(); output.getParentFile().mkdirs();
LockFile lf = new LockFile(output); LockFile lf = new LockFile(output);
if (!lf.lock()) if (!lf.lock())
throw die("Cannot lock " + output); throw die(MessageFormat.format(CLIText.get().cannotLock, output));
try { try {
OutputStream os = lf.getOutputStream(); OutputStream os = lf.getOutputStream();
try { try {
@ -107,7 +109,7 @@ class Iplog extends TextBuiltin {
os.close(); os.close();
} }
if (!lf.commit()) if (!lf.commit())
throw die("Cannot write " + output); throw die(MessageFormat.format(CLIText.get().cannotWrite, output));
} finally { } finally {
lf.unlock(); lf.unlock();
} }

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

@ -51,22 +51,23 @@ import java.net.URL;
import org.eclipse.jgit.iplog.IpLogMeta; import org.eclipse.jgit.iplog.IpLogMeta;
import org.eclipse.jgit.iplog.SimpleCookieManager; import org.eclipse.jgit.iplog.SimpleCookieManager;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.Command; import org.eclipse.jgit.pgm.Command;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
@Command(name = "eclipse-ipzilla", common = false, usage = "Synchronize IPZilla data") @Command(name = "eclipse-ipzilla", common = false, usage = "usage_synchronizeIPZillaData")
class Ipzilla extends TextBuiltin { class Ipzilla extends TextBuiltin {
@Option(name = "--url", metaVar = "URL", usage = "IPZilla URL") @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/";
@Option(name = "--username", metaVar = "USER", usage = "IPZilla Username") @Option(name = "--username", metaVar = "metaVar_user", usage = "usage_IPZillaUsername")
private String username; private String username;
@Option(name = "--password", metaVar = "PASS", usage = "IPZilla Password") @Option(name = "--password", metaVar = "metaVar_pass", usage = "usage_IPZillaPassword")
private String password; private String password;
@Option(name = "--file", aliases = { "-f" }, metaVar = "FILE", usage = "Input/output file") @Option(name = "--file", aliases = { "-f" }, metaVar = "metaVar_file", usage = "usage_inputOutputFile")
private File output; private File output;
@Override @Override
@ -81,7 +82,7 @@ class Ipzilla extends TextBuiltin {
null, // null, //
ipzilla.getPort(), // ipzilla.getPort(), //
ipzilla.getProtocol(), // ipzilla.getProtocol(), //
"IPZilla Password", // CLIText.get().IPZillaPasswordPrompt, //
ipzilla.getProtocol(), // ipzilla.getProtocol(), //
ipzilla, // ipzilla, //
Authenticator.RequestorType.SERVER); Authenticator.RequestorType.SERVER);

15
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java

@ -46,6 +46,7 @@ package org.eclipse.jgit.pgm.opt;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.CmdLineParser;
@ -59,6 +60,7 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.WindowCursor; import org.eclipse.jgit.lib.WindowCursor;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.treewalk.AbstractTreeIterator; import org.eclipse.jgit.treewalk.AbstractTreeIterator;
import org.eclipse.jgit.treewalk.CanonicalTreeParser; import org.eclipse.jgit.treewalk.CanonicalTreeParser;
import org.eclipse.jgit.treewalk.FileTreeIterator; import org.eclipse.jgit.treewalk.FileTreeIterator;
@ -102,7 +104,7 @@ public class AbstractTreeIteratorHandler extends
try { try {
dirc = DirCache.read(new File(name)); dirc = DirCache.read(new File(name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(name + " is not an index file", e); throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e);
} }
setter.addValue(new DirCacheIterator(dirc)); setter.addValue(new DirCacheIterator(dirc));
return 1; return 1;
@ -115,19 +117,18 @@ public class AbstractTreeIteratorHandler extends
throw new CmdLineException(e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(name + " is not a tree"); throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
final CanonicalTreeParser p = new CanonicalTreeParser(); final CanonicalTreeParser p = new CanonicalTreeParser();
final WindowCursor curs = new WindowCursor(); final WindowCursor curs = new WindowCursor();
try { try {
p.reset(clp.getRepository(), clp.getRevWalk().parseTree(id), curs); p.reset(clp.getRepository(), clp.getRevWalk().parseTree(id), curs);
} catch (MissingObjectException e) { } catch (MissingObjectException e) {
throw new CmdLineException(name + " is not a tree"); throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(name + " is not a tree"); throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException("cannot read " + name + ": " throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
+ e.getMessage());
} finally { } finally {
curs.release(); curs.release();
} }
@ -138,6 +139,6 @@ public class AbstractTreeIteratorHandler extends
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "tree-ish"; return CLIText.get().metaVar_treeish;
} }
} }

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

@ -51,6 +51,7 @@ import org.kohsuke.args4j.IllegalAnnotationError;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree; import org.eclipse.jgit.revwalk.RevTree;
@ -149,7 +150,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
*/ */
public Repository getRepository() { public Repository getRepository() {
if (db == null) if (db == null)
throw new IllegalStateException("No Git repository configured."); throw new IllegalStateException(CLIText.get().noGitRepositoryConfigured);
return db; return db;
} }

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java

@ -45,6 +45,7 @@
package org.eclipse.jgit.pgm.opt; package org.eclipse.jgit.pgm.opt;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.CmdLineParser;
@ -53,6 +54,7 @@ import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Parameters; import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.pgm.CLIText;
/** /**
* Custom argument handler {@link ObjectId} from string values. * Custom argument handler {@link ObjectId} from string values.
@ -91,11 +93,11 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> {
return 1; return 1;
} }
throw new CmdLineException(name + " is not an object"); throw new CmdLineException(MessageFormat.format(CLIText.get().notAnObject, name));
} }
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "object"; return CLIText.get().metaVar_object;
} }
} }

3
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java

@ -53,6 +53,7 @@ import org.kohsuke.args4j.OptionDef;
import org.kohsuke.args4j.spi.OptionHandler; import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Parameters; import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.treewalk.filter.PathFilter; import org.eclipse.jgit.treewalk.filter.PathFilter;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup; import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.eclipse.jgit.treewalk.filter.TreeFilter;
@ -103,6 +104,6 @@ public class PathTreeFilterHandler extends OptionHandler<TreeFilter> {
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "path ..."; return CLIText.get().metaVar_paths;
} }
} }

3
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java

@ -49,6 +49,7 @@ import org.kohsuke.args4j.OptionDef;
import org.kohsuke.args4j.spi.OptionHandler; import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Parameters; import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RefSpec;
/** /**
@ -79,6 +80,6 @@ public class RefSpecHandler extends OptionHandler<RefSpec> {
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "refspec"; return CLIText.get().metaVar_refspec;
} }
} }

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

@ -45,6 +45,7 @@
package org.eclipse.jgit.pgm.opt; package org.eclipse.jgit.pgm.opt;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.CmdLineParser;
@ -55,6 +56,7 @@ import org.kohsuke.args4j.spi.Setter;
import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevFlag; import org.eclipse.jgit.revwalk.RevFlag;
@ -94,8 +96,8 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
final int dot2 = name.indexOf(".."); final int dot2 = name.indexOf("..");
if (dot2 != -1) { if (dot2 != -1) {
if (!option.isMultiValued()) if (!option.isMultiValued())
throw new CmdLineException("Only one " + option.metaVar() throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn
+ " expected in " + name + "." + ""); , option.metaVar(), name));
final String left = name.substring(0, dot2); final String left = name.substring(0, dot2);
final String right = name.substring(dot2 + 2); final String right = name.substring(dot2 + 2);
@ -117,18 +119,17 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
throw new CmdLineException(e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(name + " is not a commit"); throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
final RevCommit c; final RevCommit c;
try { try {
c = clp.getRevWalk().parseCommit(id); c = clp.getRevWalk().parseCommit(id);
} catch (MissingObjectException e) { } catch (MissingObjectException e) {
throw new CmdLineException(name + " is not a commit"); throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(name + " is not a commit"); throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException("cannot read " + name + ": " throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
+ e.getMessage());
} }
if (interesting) if (interesting)
@ -141,6 +142,6 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "commit-ish"; return CLIText.get().metaVar_commitish;
} }
} }

13
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java

@ -45,6 +45,7 @@
package org.eclipse.jgit.pgm.opt; package org.eclipse.jgit.pgm.opt;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.CmdLineParser;
@ -55,6 +56,7 @@ import org.kohsuke.args4j.spi.Setter;
import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.revwalk.RevTree; import org.eclipse.jgit.revwalk.RevTree;
/** /**
@ -90,18 +92,17 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
throw new CmdLineException(e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(name + " is not a tree"); throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
final RevTree c; final RevTree c;
try { try {
c = clp.getRevWalk().parseTree(id); c = clp.getRevWalk().parseTree(id);
} catch (MissingObjectException e) { } catch (MissingObjectException e) {
throw new CmdLineException(name + " is not a tree"); throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(name + " is not a tree"); throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException("cannot read " + name + ": " throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
+ e.getMessage());
} }
setter.addValue(c); setter.addValue(c);
return 1; return 1;
@ -109,6 +110,6 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "tree-ish"; return CLIText.get().metaVar_treeish;
} }
} }

5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java

@ -51,6 +51,7 @@ import org.kohsuke.args4j.OptionDef;
import org.kohsuke.args4j.spi.OptionHandler; import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Parameters; import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.CommandCatalog; import org.eclipse.jgit.pgm.CommandCatalog;
import org.eclipse.jgit.pgm.CommandRef; import org.eclipse.jgit.pgm.CommandRef;
import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.TextBuiltin;
@ -82,7 +83,7 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> {
final CommandRef cr = CommandCatalog.get(name); final CommandRef cr = CommandCatalog.get(name);
if (cr == null) if (cr == null)
throw new CmdLineException(MessageFormat.format( throw new CmdLineException(MessageFormat.format(
"{0} is not a jgit command", name)); CLIText.get().notAJgitCommand, name));
// Force option parsing to stop. Everything after us should // Force option parsing to stop. Everything after us should
// be arguments known only to this command and must not be // be arguments known only to this command and must not be
@ -95,6 +96,6 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> {
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return "command"; return CLIText.get().metaVar_command;
} }
} }

6
org.eclipse.jgit.test/META-INF/MANIFEST.MF

@ -10,15 +10,21 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: junit.framework;version="[3.8.2,4.0.0)", Import-Package: junit.framework;version="[3.8.2,4.0.0)",
junit.textui;version="[3.8.2,4.0.0)", junit.textui;version="[3.8.2,4.0.0)",
org.eclipse.jgit.api;version="[0.8.0,0.9.0)", org.eclipse.jgit.api;version="[0.8.0,0.9.0)",
org.eclipse.jgit;version="[0.8.0,0.9.0)",
org.eclipse.jgit.awtui;version="[0.8.0,0.9.0)",
org.eclipse.jgit.console;version="[0.8.0,0.9.0)",
org.eclipse.jgit.diff;version="[0.8.0,0.9.0)", org.eclipse.jgit.diff;version="[0.8.0,0.9.0)",
org.eclipse.jgit.dircache;version="[0.8.0,0.9.0)", org.eclipse.jgit.dircache;version="[0.8.0,0.9.0)",
org.eclipse.jgit.errors;version="[0.8.0,0.9.0)", org.eclipse.jgit.errors;version="[0.8.0,0.9.0)",
org.eclipse.jgit.fnmatch;version="[0.8.0,0.9.0)", org.eclipse.jgit.fnmatch;version="[0.8.0,0.9.0)",
org.eclipse.jgit.http.server;version="[0.8.0,0.9.0)",
org.eclipse.jgit.iplog;version="[0.8.0,0.9.0)",
org.eclipse.jgit.junit;version="[0.8.0,0.9.0)", org.eclipse.jgit.junit;version="[0.8.0,0.9.0)",
org.eclipse.jgit.lib;version="[0.8.0,0.9.0)", org.eclipse.jgit.lib;version="[0.8.0,0.9.0)",
org.eclipse.jgit.merge;version="[0.8.0,0.9.0)", org.eclipse.jgit.merge;version="[0.8.0,0.9.0)",
org.eclipse.jgit.nls;version="[0.8.0,0.9.0)", org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.patch;version="[0.8.0,0.9.0)", org.eclipse.jgit.patch;version="[0.8.0,0.9.0)",
org.eclipse.jgit.pgm;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)", org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk.filter;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk.filter;version="[0.8.0,0.9.0)",

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java

@ -44,8 +44,11 @@
package org.eclipse.jgit.lib; package org.eclipse.jgit.lib;
import java.text.MessageFormat;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.errors.CorruptObjectException;
public class ObjectCheckerTest extends TestCase { public class ObjectCheckerTest extends TestCase {
@ -62,7 +65,7 @@ public class ObjectCheckerTest extends TestCase {
fail("Did not throw CorruptObjectException"); fail("Did not throw CorruptObjectException");
} catch (CorruptObjectException e) { } catch (CorruptObjectException e) {
final String m = e.getMessage(); final String m = e.getMessage();
assertEquals("Invalid object type: " + Constants.OBJ_BAD, m); assertEquals(MessageFormat.format(JGitText.get().corruptObjectInvalidType2, Constants.OBJ_BAD), m);
} }
} }

12
org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java

@ -55,23 +55,23 @@ public class TestNLS extends TestCase {
public void testNLSLocale() { public void testNLSLocale() {
NLS.setLocale(NLS.ROOT_LOCALE); NLS.setLocale(NLS.ROOT_LOCALE);
GermanTranslatedBundle bundle = GermanTranslatedBundle.get(); GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
NLS.setLocale(Locale.GERMAN); NLS.setLocale(Locale.GERMAN);
bundle = GermanTranslatedBundle.get(); bundle = GermanTranslatedBundle.get();
assertEquals(Locale.GERMAN, bundle.getEffectiveLocale()); assertEquals(Locale.GERMAN, bundle.effectiveLocale());
} }
public void testJVMDefaultLocale() { public void testJVMDefaultLocale() {
Locale.setDefault(NLS.ROOT_LOCALE); Locale.setDefault(NLS.ROOT_LOCALE);
NLS.useJVMDefaultLocale(); NLS.useJVMDefaultLocale();
GermanTranslatedBundle bundle = GermanTranslatedBundle.get(); GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
Locale.setDefault(Locale.GERMAN); Locale.setDefault(Locale.GERMAN);
NLS.useJVMDefaultLocale(); NLS.useJVMDefaultLocale();
bundle = GermanTranslatedBundle.get(); bundle = GermanTranslatedBundle.get();
assertEquals(Locale.GERMAN, bundle.getEffectiveLocale()); assertEquals(Locale.GERMAN, bundle.effectiveLocale());
} }
public void testThreadTranslationBundleInheritance() throws InterruptedException { public void testThreadTranslationBundleInheritance() throws InterruptedException {
@ -135,7 +135,7 @@ public class TestNLS extends TestCase {
assertNull("t1 was interrupted or barrier was broken", t1.e); assertNull("t1 was interrupted or barrier was broken", t1.e);
assertNull("t2 was interrupted or barrier was broken", t2.e); assertNull("t2 was interrupted or barrier was broken", t2.e);
assertEquals(NLS.ROOT_LOCALE, t1.bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, t1.bundle.effectiveLocale());
assertEquals(Locale.GERMAN, t2.bundle.getEffectiveLocale()); assertEquals(Locale.GERMAN, t2.bundle.effectiveLocale());
} }
} }

10
org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java

@ -79,15 +79,15 @@ public class TestTranslationBundle extends TestCase {
NonTranslatedBundle bundle = new NonTranslatedBundle(); NonTranslatedBundle bundle = new NonTranslatedBundle();
bundle.load(NLS.ROOT_LOCALE); bundle.load(NLS.ROOT_LOCALE);
assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning); assertEquals("Good morning {0}", bundle.goodMorning);
bundle.load(Locale.ENGLISH); bundle.load(Locale.ENGLISH);
assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning); assertEquals("Good morning {0}", bundle.goodMorning);
bundle.load(Locale.GERMAN); bundle.load(Locale.GERMAN);
assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning); assertEquals("Good morning {0}", bundle.goodMorning);
} }
@ -95,11 +95,11 @@ public class TestTranslationBundle extends TestCase {
GermanTranslatedBundle bundle = new GermanTranslatedBundle(); GermanTranslatedBundle bundle = new GermanTranslatedBundle();
bundle.load(NLS.ROOT_LOCALE); bundle.load(NLS.ROOT_LOCALE);
assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale()); assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning); assertEquals("Good morning {0}", bundle.goodMorning);
bundle.load(Locale.GERMAN); bundle.load(Locale.GERMAN);
assertEquals(Locale.GERMAN, bundle.getEffectiveLocale()); assertEquals(Locale.GERMAN, bundle.effectiveLocale());
assertEquals("Guten Morgen {0}", bundle.goodMorning); assertEquals("Guten Morgen {0}", bundle.goodMorning);
} }

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java

@ -45,6 +45,9 @@ package org.eclipse.jgit.patch;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.text.MessageFormat;
import org.eclipse.jgit.JGitText;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -57,7 +60,7 @@ public class PatchCcErrorTest extends TestCase {
final FormatError e = p.getErrors().get(0); final FormatError e = p.getErrors().get(0);
assertSame(FormatError.Severity.ERROR, e.getSeverity()); assertSame(FormatError.Severity.ERROR, e.getSeverity());
assertEquals( assertEquals(
"Truncated hunk, at least 1 lines is missing for ancestor 1", MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 1, 1),
e.getMessage()); e.getMessage());
assertEquals(346, e.getOffset()); assertEquals(346, e.getOffset());
assertTrue(e.getLineText().startsWith( assertTrue(e.getLineText().startsWith(
@ -67,7 +70,7 @@ public class PatchCcErrorTest extends TestCase {
final FormatError e = p.getErrors().get(1); final FormatError e = p.getErrors().get(1);
assertSame(FormatError.Severity.ERROR, e.getSeverity()); assertSame(FormatError.Severity.ERROR, e.getSeverity());
assertEquals( assertEquals(
"Truncated hunk, at least 2 lines is missing for ancestor 2", MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 2, 2),
e.getMessage()); e.getMessage());
assertEquals(346, e.getOffset()); assertEquals(346, e.getOffset());
assertTrue(e.getLineText().startsWith( assertTrue(e.getLineText().startsWith(

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java

@ -53,9 +53,11 @@ import static org.eclipse.jgit.transport.SideBandOutputStream.SMALL_BUF;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.text.MessageFormat;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Constants;
// Note, test vectors created with: // Note, test vectors created with:
@ -221,8 +223,7 @@ public class SideBandOutputStreamTest extends TestCase {
new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut); new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut);
fail("Accepted " + Integer.MAX_VALUE + " for buffer size"); fail("Accepted " + Integer.MAX_VALUE + " for buffer size");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
assertEquals("packet size " + Integer.MAX_VALUE assertEquals(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, Integer.MAX_VALUE, 65520), e.getMessage());
+ " must be <= 65520", e.getMessage());
} }
} }

1
org.eclipse.jgit.ui/.classpath

@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

1
org.eclipse.jgit.ui/META-INF/MANIFEST.MF

@ -8,6 +8,7 @@ Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jgit.awtui;version="0.8.0" Export-Package: org.eclipse.jgit.awtui;version="0.8.0"
Import-Package: org.eclipse.jgit.lib;version="[0.8.0,0.9.0)", Import-Package: org.eclipse.jgit.lib;version="[0.8.0,0.9.0)",
org.eclipse.jgit.nls;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)", org.eclipse.jgit.revplot;version="[0.8.0,0.9.0)",
org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)", org.eclipse.jgit.revwalk;version="[0.8.0,0.9.0)",
org.eclipse.jgit.transport;version="[0.8.0,0.9.0)", org.eclipse.jgit.transport;version="[0.8.0,0.9.0)",

3
org.eclipse.jgit.ui/pom.xml

@ -84,6 +84,9 @@
<include>plugin.properties</include> <include>plugin.properties</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>resources/</directory>
</resource>
</resources> </resources>
<plugins> <plugins>

8
org.eclipse.jgit.ui/resources/org/eclipse/jgit/awtui/UIText.properties

@ -0,0 +1,8 @@
authenticationRequired=Authentication Required
author=Author
date=Date
enterUsernameAndPasswordFor=Enter username and password for
mustBeSpecialTableModel=Must be special table model.
password=Password:
username=Username:
warning=Warning

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

@ -74,7 +74,8 @@ public class AwtAuthenticator extends CachedAuthenticator {
panel.setLayout(new GridBagLayout()); panel.setLayout(new GridBagLayout());
final StringBuilder instruction = new StringBuilder(); final StringBuilder instruction = new StringBuilder();
instruction.append("Enter username and password for "); instruction.append(UIText.get().enterUsernameAndPasswordFor);
instruction.append(" ");
if (getRequestorType() == RequestorType.PROXY) { if (getRequestorType() == RequestorType.PROXY) {
instruction.append(getRequestorType()); instruction.append(getRequestorType());
instruction.append(" "); instruction.append(" ");
@ -101,7 +102,7 @@ public class AwtAuthenticator extends CachedAuthenticator {
gbc.fill = GridBagConstraints.NONE; gbc.fill = GridBagConstraints.NONE;
gbc.gridx = 0; gbc.gridx = 0;
gbc.weightx = 1; gbc.weightx = 1;
panel.add(new JLabel("Username:"), gbc); panel.add(new JLabel(UIText.get().username), gbc);
gbc.gridx = 1; gbc.gridx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL; gbc.fill = GridBagConstraints.HORIZONTAL;
@ -116,7 +117,7 @@ public class AwtAuthenticator extends CachedAuthenticator {
gbc.fill = GridBagConstraints.NONE; gbc.fill = GridBagConstraints.NONE;
gbc.gridx = 0; gbc.gridx = 0;
gbc.weightx = 1; gbc.weightx = 1;
panel.add(new JLabel("Password:"), gbc); panel.add(new JLabel(UIText.get().password), gbc);
gbc.gridx = 1; gbc.gridx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL; gbc.fill = GridBagConstraints.HORIZONTAL;
@ -126,7 +127,7 @@ public class AwtAuthenticator extends CachedAuthenticator {
gbc.gridy++; gbc.gridy++;
if (JOptionPane.showConfirmDialog(null, panel, if (JOptionPane.showConfirmDialog(null, panel,
"Authentication Required", JOptionPane.OK_CANCEL_OPTION, UIText.get().authenticationRequired, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) { JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
return new PasswordAuthentication(username.getText(), password return new PasswordAuthentication(username.getText(), password
.getPassword()); .getPassword());

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

@ -96,7 +96,7 @@ public class AwtSshSessionFactory extends SshConfigSessionFactory {
} }
public boolean promptYesNo(final String msg) { public boolean promptYesNo(final String msg) {
return JOptionPane.showConfirmDialog(null, msg, "Warning", return JOptionPane.showConfirmDialog(null, msg, UIText.get().warning,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
} }

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

@ -112,7 +112,7 @@ public class CommitGraphPane extends JTable {
@Override @Override
public void setModel(final TableModel dataModel) { public void setModel(final TableModel dataModel) {
if (dataModel != null && !(dataModel instanceof CommitTableModel)) if (dataModel != null && !(dataModel instanceof CommitTableModel))
throw new ClassCastException("Must be special table model."); throw new ClassCastException(UIText.get().mustBeSpecialTableModel);
super.setModel(dataModel); super.setModel(dataModel);
} }
@ -130,8 +130,8 @@ public class CommitGraphPane extends JTable {
final TableColumn date = cols.getColumn(2); final TableColumn date = cols.getColumn(2);
graph.setHeaderValue(""); graph.setHeaderValue("");
author.setHeaderValue("Author"); author.setHeaderValue(UIText.get().author);
date.setHeaderValue("Date"); date.setHeaderValue(UIText.get().date);
graph.setCellRenderer(new GraphCellRender()); graph.setCellRenderer(new GraphCellRender());
author.setCellRenderer(new NameCellRender()); author.setCellRenderer(new NameCellRender());

69
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/UIText.java

@ -0,0 +1,69 @@
/*
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Eclipse Foundation, Inc. nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.eclipse.jgit.awtui;
import org.eclipse.jgit.nls.NLS;
import org.eclipse.jgit.nls.TranslationBundle;
/**
* Translation bundle for JGit UI
*/
public class UIText extends TranslationBundle {
/**
* @return an instance of this translation bundle
*/
public static UIText get() {
return NLS.getBundleFor(UIText.class);
}
/***/ public String authenticationRequired;
/***/ public String author;
/***/ public String date;
/***/ public String enterUsernameAndPasswordFor;
/***/ public String mustBeSpecialTableModel;
/***/ public String password;
/***/ public String username;
/***/ public String warning;
}

1
org.eclipse.jgit/.classpath

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

3
org.eclipse.jgit/META-INF/MANIFEST.MF

@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.jgit
Bundle-Version: 0.8.0.qualifier Bundle-Version: 0.8.0.qualifier
Bundle-Localization: plugin Bundle-Localization: plugin
Bundle-Vendor: %provider_name Bundle-Vendor: %provider_name
Export-Package: org.eclipse.jgit.api;version="0.8.0", Export-Package: org.eclipse.jgit;version="0.8.0",
org.eclipse.jgit.api;version="0.8.0",
org.eclipse.jgit.diff;version="0.8.0", org.eclipse.jgit.diff;version="0.8.0",
org.eclipse.jgit.dircache;version="0.8.0", org.eclipse.jgit.dircache;version="0.8.0",
org.eclipse.jgit.errors;version="0.8.0", org.eclipse.jgit.errors;version="0.8.0",

3
org.eclipse.jgit/pom.xml

@ -84,6 +84,9 @@
<include>plugin.properties</include> <include>plugin.properties</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>resources/</directory>
</resource>
</resources> </resources>
<plugins> <plugins>

360
org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties

@ -0,0 +1,360 @@
DIRCChecksumMismatch=DIRC checksum mismatch
DIRCExtensionIsTooLargeAt=DIRC extension {0} is too large at {1} bytes.
DIRCExtensionNotSupportedByThisVersion=DIRC extension {0} not supported by this version.
DIRCHasTooManyEntries=DIRC has too many entries.
JRELacksMD5Implementation=JRE lacks MD5 implementation
URINotSupported=URI not supported: {0}
URLNotFound={0} not found
aNewObjectIdIsRequired=A NewObjectId is required.
advertisementCameBefore=advertisement of {0}^{} came before {1}
advertisementOfCameBefore=advertisement of {0}^{} came before {1}
amazonS3ActionFailed={0} of '{1}' failed: {2} {3}
amazonS3ActionFailedGivingUp={0} of '{1}' failed: Giving up after {2} attempts.
anExceptionOccurredWhileTryingToAddTheIdOfHEAD=An exception occurred while trying to add the Id of HEAD
anSSHSessionHasBeenAlreadyCreated=An SSH session has been already created
atLeastOnePathIsRequired=At least one path is required.
atLeastTwoFiltersNeeded=At least two filters needed.
badBase64InputCharacterAt=Bad Base64 input character at {0} : {1} (decimal)
badEntryDelimiter=Bad entry delimiter
badEntryName=Bad entry name: {0}
badEscape=Bad escape: {0}
badGroupHeader=Bad group header
badObjectType=Bad object type: {0}
badSectionEntry=Bad section entry: {0}
base64InputNotProperlyPadded=Base64 input not properly padded.
baseLengthIncorrect=base length incorrect
blobNotFound=Blob not found: {0}
blobNotFoundForPath=Blob not found: {0} for path: {1}
cannotBeCombined=Cannot be combined.
cannotCombineTreeFilterWithRevFilter=Cannot combine TreeFilter {0} with RefFilter {1}.
cannotCommitWriteTo=Cannot commit write to {0}
cannotConnectPipes=cannot connect pipes
cannotConvertScriptToText=Cannot convert script to text
cannotCreateConfig=cannot create config
cannotCreateDirectory=Cannot create directory {0}
cannotCreateHEAD=cannot create HEAD
cannotDeleteFile=Cannot delete file: {0}
cannotDeleteStaleTrackingRef2=Cannot delete stale tracking ref {0}: {1}
cannotDeleteStaleTrackingRef=Cannot delete stale tracking ref {0}
cannotDetermineProxyFor=Cannot determine proxy for {0}
cannotDownload=Cannot download {0}
cannotExecute=cannot execute: {0}
cannotGet=Cannot get {0}
cannotListRefs=cannot list refs
cannotLock=Cannot lock {0}
cannotLockFile=Cannot lock file {0}
cannotLockPackIn=Cannot lock pack in {0}
cannotMatchOnEmptyString=Cannot match on empty string.
cannotMoveIndexTo=Cannot move index to {0}
cannotMovePackTo=Cannot move pack to {0}
cannotOpenService=cannot open {0}
cannotParseGitURIish=Cannot parse Git URI-ish
cannotRead=Cannot read {0}
cannotReadBlob=Cannot read blob {0}
cannotReadCommit=Cannot read commit {0}
cannotReadFile=Cannot read file {0}
cannotReadHEAD=cannot read HEAD: {0} {1}
cannotReadObject=Cannot read object
cannotReadTree=Cannot read tree {0}
cannotResolveLocalTrackingRefForUpdating=Cannot resolve local tracking ref {0} for updating.
cannotStoreObjects=cannot store objects
cannotUnloadAModifiedTree=Cannot unload a modified tree.
cannotWorkWithOtherStagesThanZeroRightNow=Cannot work with other stages than zero right now. Won't write corrupt index.
cantFindObjectInReversePackIndexForTheSpecifiedOffset=Can't find object in (reverse) pack index for the specified offset {0}
cantPassMeATree=Can't pass me a tree!
channelMustBeInRange0_255=channel {0} must be in range [0, 255]
characterClassIsNotSupported=The character class {0} is not supported.
checkoutConflictWithFile=Checkout conflict with file: {0}
checkoutConflictWithFiles=Checkout conflict with files: {0}
classCastNotA=Not a {0}
collisionOn=Collision on {0}
commandWasCalledInTheWrongState=Command {0} was called in the wrong state
commitAlreadyExists=exists {0}
commitMessageNotSpecified=commit message not specified
commitOnRepoWithoutHEADCurrentlyNotSupported=Commit on repo without HEAD currently not supported
compressingObjects=Compressing objects
connectionFailed=connection failed
connectionTimeOut=Connection time out: {0}
contextMustBeNonNegative=context must be >= 0
corruptObjectBadStream=bad stream
corruptObjectBadStreamCorruptHeader=bad stream, corrupt header
corruptObjectGarbageAfterSize=garbage after size
corruptObjectIncorrectLength=incorrect length
corruptObjectInvalidEntryMode=invalid entry mode
corruptObjectInvalidMode2=invalid mode {0}
corruptObjectInvalidMode3=invalid mode {0} for {1} '{2}' in {3}.
corruptObjectInvalidMode=invalid mode
corruptObjectInvalidType2=invalid type {0}
corruptObjectInvalidType=invalid type
corruptObjectMalformedHeader=malformed header: {0}
corruptObjectNegativeSize=negative size
corruptObjectNoAuthor=no author
corruptObjectNoCommitter=no committer
corruptObjectNoHeader=no header
corruptObjectNoObject=no object
corruptObjectNoTagName=no tag name
corruptObjectNoTaggerBadHeader=no tagger/bad header
corruptObjectNoTaggerHeader=no tagger header
corruptObjectNoType=no type
corruptObjectNotree=no tree
corruptObjectPackfileChecksumIncorrect=Packfile checksum incorrect.
corruptionDetectedReReadingAt=Corruption detected re-reading at {0}
couldNotDeleteLockFileShouldNotHappen=Could not delete lock file. Should not happen
couldNotDeleteTemporaryIndexFileShouldNotHappen=Could not delete temporary index file. Should not happen
couldNotLockHEAD=Could not lock HEAD
couldNotReadIndexInOneGo=Could not read index in one go, only {0} out of {1} read
couldNotRenameDeleteOldIndex=Could not rename delete old index
couldNotRenameTemporaryIndexFileToIndex=Could not rename temporary index file to index
couldNotURLEncodeToUTF8=Could not URL encode to UTF-8
couldNotWriteFile=Could not write file {0}
countingObjects=Counting objects
creatingDeltasIsNotImplemented=creating deltas is not implemented
daemonAlreadyRunning=Daemon already running
deletingNotSupported=Deleting {0} not supported.
destinationIsNotAWildcard=Destination is not a wildcard.
dirCacheDoesNotHaveABackingFile=DirCache does not have a backing file
dirCacheFileIsNotLocked=DirCache {0} not locked
dirCacheIsNotLocked=DirCache is not locked
doesNotHandleMode=Does not handle mode {0} ({1})
downloadCancelled=Download cancelled
downloadCancelledDuringIndexing=Download cancelled during indexing
duplicateAdvertisementsOf=duplicate advertisements of {0}
duplicateRef=Duplicate ref: {0}
duplicateRemoteRefUpdateIsIllegal=Duplicate remote ref update is illegal. Affected remote name: {0}
duplicateStagesNotAllowed=Duplicate stages not allowed
eitherGIT_DIRorGIT_WORK_TREEmustBePassed=Either GIT_DIR or GIT_WORK_TREE must be passed to Repository constructor
emptyPathNotPermitted=Empty path not permitted.
encryptionError=Encryption error: {0}
endOfFileInEscape=End of file in escape
entryNotFoundByPath=Entry not found by path: {0}
errorDecodingFromFile=Error decoding from file {0}
errorEncodingFromFile=Error encoding from file {0}
errorInBase64CodeReadingStream=Error in Base64 code reading stream.
errorInPackedRefs=error in packed-refs
errorInvalidProtocolWantedOldNewRef=error: invalid protocol: wanted 'old new ref'
errorListing=Error listing {0}
errorOccurredDuringUnpackingOnTheRemoteEnd=error occurred during unpacking on the remote end: {0}
errorReadingInfoRefs=error reading info/refs
exceptionCaughtDuringExecutionOfCommitCommand=Exception caught during execution of commit command
exceptionOccuredDuringAddingOfOptionToALogCommand=Exception occured during adding of {0} as option to a Log command
expectedACKNAKFoundEOF=Expected ACK/NAK, found EOF
expectedACKNAKGot=Expected ACK/NAK, got: {0}
expectedBooleanStringValue=Expected boolean string value
expectedCharacterEncodingGuesses=Expected {0} character encoding guesses
expectedEOFReceived=expected EOF; received '{0}' instead
expectedGot=expected '{0}', got '{1}'
expectedPktLineWithService=expected pkt-line with '# service=-', got '{0}'
expectedReceivedContentType=expected Content-Type {0}; received Content-Type {1}
expectedReportForRefNotReceived={0}: expected report for ref {1} not received
failedUpdatingRefs=failed updating refs
failureDueToOneOfTheFollowing=Failure due to one of the following:
failureUpdatingFETCH_HEAD=Failure updating FETCH_HEAD: {0}
failureUpdatingTrackingRef=Failure updating tracking ref {0}: {1}
fileCannotBeDeleted=File cannot be deleted: {0}
fileIsTooBigForThisConvenienceMethod=File is too big for this convenience method ({0} bytes).
fileIsTooLarge=File is too large: {0}
fileModeNotSetForPath=FileMode not set for path {0}
flagIsDisposed={0} is disposed.
flagNotFromThis={0} not from this.
flagsAlreadyCreated={0} flags already created.
funnyRefname=funny refname
hugeIndexesAreNotSupportedByJgitYet=Huge indexes are not supported by jgit, yet
hunkBelongsToAnotherFile=Hunk belongs to another file
hunkDisconnectedFromFile=Hunk disconnected from file
hunkHeaderDoesNotMatchBodyLineCountOf=Hunk header {0} does not match body line count of {1}
illegalArgumentNotA=Not {0}
illegalStateExists=exists {0}
improperlyPaddedBase64Input=Improperly padded Base64 input.
inMemoryBufferLimitExceeded=In-memory buffer limit exceeded
incorrectHashFor=Incorrect hash for {0}; computed {1} as a {2} from {3} bytes.
incorrectOBJECT_ID_LENGTH=Incorrect OBJECT_ID_LENGTH.
incorrectObjectType_COMMITnorTREEnorBLOBnorTAG=COMMIT nor TREE nor BLOB nor TAG
indexFileIsInUse=Index file is in use
indexFileIsTooLargeForJgit=Index file is too large for jgit
indexSignatureIsInvalid=Index signature is invalid: {0}
integerValueOutOfRange=Integer value {0}.{1} out of range
internalRevisionError=internal revision error
interruptedWriting=Interrupted writing {0}
invalidAdvertisementOf=invalid advertisement of {0}
invalidAncestryLength=Invalid ancestry length
invalidBooleanValue=Invalid boolean value: {0}.{1}={2}
invalidChannel=Invalid channel {0}
invalidCharacterInBase64Data=Invalid character in Base64 data.
invalidCommitParentNumber=Invalid commit parent number
invalidEncryption=Invalid encryption
invalidGitType=invalid git type: {0}
invalidId=Invalid id {0}
invalidIdLength=Invalid id length {0}; should be {1}
invalidIntegerValue=Invalid integer value: {0}.{1}={2}
invalidKey=Invalid key: {0}
invalidLineInConfigFile=Invalid line in config file
invalidModeFor=Invalid mode {0} for {1} {2} in {3}.
invalidModeForPath=Invalid mode {0} for path {1}
invalidObject=Invalid {0} {1}:{2}
invalidOldIdSent=invalid old id sent
invalidPacketLineHeader=Invalid packet line header: {0}
invalidPath=Invalid path: {0}
invalidRefName=Invalid ref name: {0}
invalidStageForPath=Invalid stage {0} for path {1}
invalidTagOption=Invalid tag option: {0}
invalidTimeout=Invalid timeout: {0}
invalidURL=Invalid URL {0}
invalidWildcards=Invalid wildcards {0}
invalidWindowSize=Invalid window size
isAStaticFlagAndHasNorevWalkInstance={0} is a static flag and has no RevWalk instance
kNotInRange=k {0} not in {1} - {2}
lengthExceedsMaximumArraySize=Length exceeds maximum array size
listingAlternates=Listing alternates
localObjectsIncomplete=Local objects incomplete.
localRefIsMissingObjects=Local ref {0} is missing object(s).
lockCountMustBeGreaterOrEqual1=lockCount must be >= 1
lockError=lock error: {0}
lockOnNotClosed=Lock on {0} not closed.
lockOnNotHeld=Lock on {0} not held.
malformedpersonIdentString=Malformed PersonIdent string (no < was found): {0}
mergeStrategyAlreadyExistsAsDefault=Merge strategy "{0}" already exists as a default strategy
missingAccesskey=Missing accesskey.
missingForwardImageInGITBinaryPatch=Missing forward-image in GIT binary patch
missingObject=Missing {0} {1}
missingPrerequisiteCommits=missing prerequisite commits:
missingSecretkey=Missing secretkey.
mixedStagesNotAllowed=Mixed stages not allowed
multipleMergeBasesFor=Multiple merge bases for:\n {0}\n {1} found:\n {2}\n {3}
need2Arguments=Need 2 arguments
needPackOut=need packOut
needsAtLeastOneEntry=Needs at least one entry
needsWorkdir=Needs workdir
newlineInQuotesNotAllowed=Newline in quotes not allowed
noApplyInDelete=No apply in delete
noClosingBracket=No closing {0} found for {1} at index {2}.
noHEADExistsAndNoExplicitStartingRevisionWasSpecified=No HEAD exists and no explicit starting revision was specified
noHMACsupport=No {0} support: {1}
noSuchRef=no such ref
noXMLParserAvailable=No XML parser available.
notABoolean=Not a boolean: {0}
notABundle=not a bundle
notADIRCFile=Not a DIRC file.
notAGitDirectory=not a git directory
notAPACKFile=Not a PACK file.
notARef=Not a ref: {0}: {1}
notASCIIString=Not ASCII string: {0}
notAValidPack=Not a valid pack {0}
notFound=not found.
notValid={0} not valid
nothingToFetch=Nothing to fetch.
nothingToPush=Nothing to push.
objectAtHasBadZlibStream=Object at {0} in {1} has bad zlib stream
objectAtPathDoesNotHaveId=Object at path "{0}" does not have an id assigned. All object ids must be assigned prior to writing a tree.
objectIsCorrupt=Object {0} is corrupt: {1}
objectIsNotA=Object {0} is not a {1}.
objectNotFoundIn=Object {0} not found in {1}.
offsetWrittenDeltaBaseForObjectNotFoundInAPack=Offset-written delta base for object not found in a pack
onlyOneFetchSupported=Only one fetch supported
onlyOneOperationCallPerConnectionIsSupported=Only one operation call per connection is supported.
openFilesMustBeAtLeast1=Open files must be >= 1
openingConnection=Opening connection
outputHasAlreadyBeenStarted=Output has already been started.
packChecksumMismatch=Pack checksum mismatch
packCorruptedWhileWritingToFilesystem=Pack corrupted while writing to filesystem
packDoesNotMatchIndex=Pack {0} does not match index
packFileInvalid=Pack file invalid: {0}
packHasUnresolvedDeltas=pack has unresolved deltas
packObjectCountMismatch=Pack object count mismatch: pack {0} index {1}: {2}
packTooLargeForIndexVersion1=Pack too large for index version 1
packetSizeMustBeAtLeast=packet size {0} must be >= {1}
packetSizeMustBeAtMost=packet size {0} must be <= {1}
packfileCorruptionDetected=Packfile corruption detected: {0}
packfileIsTruncated=Packfile is truncated.
packingCancelledDuringObjectsWriting=Packing cancelled during objects writing
pathIsNotInWorkingDir=Path is not in working dir
peeledLineBeforeRef=Peeled line before ref.
peeledLineBeforeRef=Peeled line before ref.
peerDidNotSupplyACompleteObjectGraph=peer did not supply a complete object graph
prefixRemote=remote:
problemWithResolvingPushRefSpecsLocally=Problem with resolving push ref specs locally: {0}
progressMonUploading=Uploading {0}
propertyIsAlreadyNonNull=Property is already non null
pushCancelled=push cancelled
pushIsNotSupportedForBundleTransport=Push is not supported for bundle transport
pushNotPermitted=push not permitted
rawLogMessageDoesNotParseAsLogEntry=Raw log message does not parse as log entry
readTimedOut=Read timed out
readingObjectsFromLocalRepositoryFailed=reading objects from local repository failed: {0}
receivingObjects=Receiving objects
refUpdateReturnCodeWas=RefUpdate return code was: {0}
reflogsNotYetSupportedByRevisionParser=reflogs not yet supported by revision parser
remoteConfigHasNoURIAssociated=Remote config "{0}" has no URIs associated
remoteDoesNotHaveSpec=Remote does not have {0} available for fetch.
remoteDoesNotSupportSmartHTTPPush=remote does not support smart HTTP push
remoteHungUpUnexpectedly=remote hung up unexpectedly
remoteNameCantBeNull=Remote name can't be null.
repositoryAlreadyExists=Repository already exists: {0}
repositoryNotFound=repository not found: {0}
requiredHashFunctionNotAvailable=Required hash function {0} not available.
resolvingDeltas=Resolving deltas
serviceNotPermitted={0} not permitted
shortCompressedStreamAt=Short compressed stream at {0}
shortReadOfBlock=Short read of block.
shortReadOfOptionalDIRCExtensionExpectedAnotherBytes=Short read of optional DIRC extension {0}; expected another {1} bytes within the section.
shortSkipOfBlock=Short skip of block.
smartHTTPPushDisabled=smart HTTP push disabled
sourceDestinationMustMatch=Source/Destination must match.
sourceIsNotAWildcard=Source is not a wildcard.
sourceRefDoesntResolveToAnyObject=Source ref {0} doesn't resolve to any object.
sourceRefNotSpecifiedForRefspec=Source ref not specified for refspec: {0}
staleRevFlagsOn=Stale RevFlags on {0}
startingReadStageWithoutWrittenRequestDataPendingIsNotSupported=Starting read stage without written request data pending is not supported
statelessRPCRequiresOptionToBeEnabled=stateless RPC requires {0} to be enabled
symlinkCannotBeWrittenAsTheLinkTarget=Symlink "{0}" cannot be written as the link target cannot be read from within Java.
tSizeMustBeGreaterOrEqual1=tSize must be >= 1
theFactoryMustNotBeNull=The factory must not be null
timerAlreadyTerminated=Timer already terminated
topologicalSortRequired=Topological sort required.
transportExceptionBadRef=Empty ref: {0}: {1}
transportExceptionEmptyRef=Empty ref: {0}
transportExceptionInvalid=Invalid {0} {1}:{2}
transportExceptionMissingAssumed=Missing assumed {0}
transportExceptionReadRef=read {0}
treeEntryAlreadyExists=Tree entry "{0}" already exists.
treeIteratorDoesNotSupportRemove=TreeIterator does not support remove()
truncatedHunkLinesMissingForAncestor=Truncated hunk, at least {0} lines missing for ancestor {1}
truncatedHunkNewLinesMissing=Truncated hunk, at least {0} new lines is missing
truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing
unableToCheckConnectivity=Unable to check connectivity.
unableToLockTag=Unable to lock tag {0}
unableToStore=Unable to store {0}.
unableToWrite=Unable to write {0}
unencodeableFile=Unencodeable file: {0}
unexpectedEndOfConfigFile=Unexpected end of config file
unexpectedHunkTrailer=Unexpected hunk trailer
unexpectedOddResult=odd: {0} + {1} - {2}
unexpectedRefReport={0}: unexpected ref report: {1}
unexpectedReportLine2={0} unexpected report line: {1}
unexpectedReportLine=unexpected report line: {0}
unknownDIRCVersion=Unknown DIRC version {0}
unknownHost=unknown host
unknownIndexVersionOrCorruptIndex=Unknown index version (or corrupt index): {0}
unknownObjectType=Unknown object type {0}.
unknownRepositoryFormat2=Unknown repository format "{0}"; expected "0".
unknownRepositoryFormat=Unknown repository format
unmergedPath=Unmerged path: {0}
unpackError=unpack error {0}
unreadablePackIndex=Unreadable pack index: {0}
unrecognizedRef=Unrecognized ref: {0}
unsupportedCommand0=unsupported command 0
unsupportedEncryptionAlgorithm=Unsupported encryption algorithm: {0}
unsupportedEncryptionVersion=Unsupported encryption version: {0}
unsupportedOperationNotAddAtEnd=Not add-at-end: {0}
unsupportedPackIndexVersion=Unsupported pack index version {0}
unsupportedPackVersion=Unsupported pack version {0}.
updatingRefFailed=Updating the ref {0} to {1} failed. ReturnCode from RefUpdate.update() was {2}
userConfigFileInvalid=User config file {0} invalid {1}
walkFailure=Walk failure.
windowSizeMustBeLesserThanLimit=Window size must be < limit
windowSizeMustBePowerOf2=Window size must be power of 2
writeTimedOut=Write timed out
writerAlreadyInitialized=Writer already initialized
writingNotPermitted=Writing not permitted
writingNotSupported=Writing {0} not supported.
writingObjects=Writing objects
wrongDecompressedLength=wrong decompressed length

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

Loading…
Cancel
Save