Browse Source

Fix javadoc in org.eclipse.jgit.pgm

Change-Id: I74616f6e8ef69bef4db2f13a9b47ddf57714fd1f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.10
Matthias Sohn 7 years ago
parent
commit
f677ee4893
  1. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleAuthenticator.java
  2. 7
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java
  3. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
  4. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java
  5. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
  6. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java
  7. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java
  8. 25
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java
  9. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java
  10. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clean.java
  11. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  12. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Command.java
  13. 11
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
  14. 16
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java
  15. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java
  16. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java
  17. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
  18. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
  19. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java
  20. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
  21. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
  22. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java
  23. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java
  24. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
  25. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
  26. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
  27. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
  28. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  29. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
  30. 12
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
  31. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java
  32. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
  33. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  34. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
  35. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java
  36. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java
  37. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java
  38. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java
  39. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevList.java
  40. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java
  41. 24
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
  42. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
  43. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
  44. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java
  45. 38
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
  46. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
  47. 44
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
  48. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
  49. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
  50. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java
  51. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
  52. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java
  53. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
  54. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
  55. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadReftable.java
  56. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  57. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java
  58. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
  59. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
  60. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
  61. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java
  62. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
  63. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java
  64. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java
  65. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
  66. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java
  67. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
  68. 20
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
  69. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java
  70. 7
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/OptionWithValuesListHandler.java
  71. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java
  72. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java
  73. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
  74. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
  75. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java
  76. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/UntrackedFilesHandler.java

5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleAuthenticator.java

@ -58,7 +58,9 @@ import org.eclipse.jgit.util.CachedAuthenticator;
* @since 4.0 * @since 4.0
*/ */
public class ConsoleAuthenticator extends CachedAuthenticator { public class ConsoleAuthenticator extends CachedAuthenticator {
/** Install this authenticator implementation into the JVM. */ /**
* Install this authenticator implementation into the JVM.
*/
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)
@ -69,6 +71,7 @@ public class ConsoleAuthenticator extends CachedAuthenticator {
private final Console cons = System.console(); private final Console cons = System.console();
/** {@inheritDoc} */
@Override @Override
protected PasswordAuthentication promptPasswordAuthentication() { protected PasswordAuthentication promptPasswordAuthentication() {
final String realm = formatRealm(); final String realm = formatRealm();

7
org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java

@ -61,7 +61,9 @@ import org.eclipse.jgit.transport.URIish;
* @since 4.0 * @since 4.0
*/ */
public class ConsoleCredentialsProvider extends CredentialsProvider { public class ConsoleCredentialsProvider extends CredentialsProvider {
/** Install this implementation as the default. */ /**
* Install this implementation as the default.
*/
public static void install() { public static void install() {
final ConsoleCredentialsProvider c = new ConsoleCredentialsProvider(); final ConsoleCredentialsProvider c = new ConsoleCredentialsProvider();
if (c.cons == null) if (c.cons == null)
@ -74,11 +76,13 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
private final Console cons = System.console(); private final Console cons = System.console();
/** {@inheritDoc} */
@Override @Override
public boolean isInteractive() { public boolean isInteractive() {
return true; return true;
} }
/** {@inheritDoc} */
@Override @Override
public boolean supports(CredentialItem... items) { public boolean supports(CredentialItem... items) {
for (CredentialItem i : items) { for (CredentialItem i : items) {
@ -100,6 +104,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
return true; return true;
} }
/** {@inheritDoc} */
@Override @Override
public boolean get(URIish uri, CredentialItem... items) public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem { throws UnsupportedCredentialItem {

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

@ -66,6 +66,14 @@ abstract class AbstractFetchCommand extends TextBuiltin {
@Option(name = "--verbose", aliases = { "-v" }, usage = "usage_beMoreVerbose") @Option(name = "--verbose", aliases = { "-v" }, usage = "usage_beMoreVerbose")
private boolean verbose; private boolean verbose;
/**
* Show fetch result.
*
* @param r
* a {@link org.eclipse.jgit.transport.FetchResult} object.
* @throws java.io.IOException
* if any.
*/
protected void showFetchResult(final FetchResult r) throws IOException { protected void showFetchResult(final FetchResult r) throws IOException {
try (ObjectReader reader = db.newObjectReader()) { try (ObjectReader reader = db.newObjectReader()) {
boolean shownURI = false; boolean shownURI = false;

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java

@ -60,6 +60,7 @@ class Add extends TextBuiltin {
@Argument(required = true, metaVar = "metaVar_filepattern", usage = "usage_filesToAddContentFrom") @Argument(required = true, metaVar = "metaVar_filepattern", usage = "usage_filesToAddContentFrom")
private List<String> filepatterns = new ArrayList<>(); private List<String> filepatterns = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -75,11 +75,13 @@ class AmazonS3Client extends TextBuiltin {
@Argument(index = 3, metaVar = "metaVar_KEY", required = true) @Argument(index = 3, metaVar = "metaVar_KEY", required = true)
private String key; private String key;
/** {@inheritDoc} */
@Override @Override
protected final boolean requiresRepository() { protected final boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final AmazonS3 s3 = new AmazonS3(properties()); final AmazonS3 s3 = new AmazonS3(properties());

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java

@ -74,6 +74,7 @@ class Archive extends TextBuiltin {
@Option(name = "--output", aliases = { "-o" }, metaVar = "metaVar_file", usage = "usage_archiveOutput") @Option(name = "--output", aliases = { "-o" }, metaVar = "metaVar_file", usage = "usage_archiveOutput")
private String output; private String output;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (tree == null) if (tree == null)

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

@ -134,6 +134,7 @@ class Blame extends TextBuiltin {
private BlameResult blame; private BlameResult blame;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (file == null) { if (file == null) {

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

@ -87,6 +87,12 @@ class Branch extends TextBuiltin {
private List<String> delete; private List<String> delete;
/**
* Delete branches
*
* @param names
* a {@link java.util.List} of branch names.
*/
@Option(name = "--delete", aliases = { @Option(name = "--delete", aliases = {
"-d" }, metaVar = "metaVar_branchNames", usage = "usage_deleteFullyMergedBranch", handler = OptionWithValuesListHandler.class) "-d" }, metaVar = "metaVar_branchNames", usage = "usage_deleteFullyMergedBranch", handler = OptionWithValuesListHandler.class)
public void delete(List<String> names) { public void delete(List<String> names) {
@ -98,6 +104,12 @@ class Branch extends TextBuiltin {
private List<String> deleteForce; private List<String> deleteForce;
/**
* Forcefully delete branches
*
* @param names
* a {@link java.util.List} of branch names.
*/
@Option(name = "--delete-force", aliases = { @Option(name = "--delete-force", aliases = {
"-D" }, metaVar = "metaVar_branchNames", usage = "usage_deleteBranchEvenIfNotMerged", handler = OptionWithValuesListHandler.class) "-D" }, metaVar = "metaVar_branchNames", usage = "usage_deleteBranchEvenIfNotMerged", handler = OptionWithValuesListHandler.class)
public void deleteForce(List<String> names) { public void deleteForce(List<String> names) {
@ -107,6 +119,12 @@ class Branch extends TextBuiltin {
deleteForce = names; deleteForce = names;
} }
/**
* Forcefully create a list of branches
*
* @param branchAndStartPoint
* a branch name and a start point
*/
@Option(name = "--create-force", aliases = { @Option(name = "--create-force", aliases = {
"-f" }, metaVar = "metaVar_branchAndStartPoint", usage = "usage_forceCreateBranchEvenExists", handler = OptionWithValuesListHandler.class) "-f" }, metaVar = "metaVar_branchAndStartPoint", usage = "usage_forceCreateBranchEvenExists", handler = OptionWithValuesListHandler.class)
public void createForce(List<String> branchAndStartPoint) { public void createForce(List<String> branchAndStartPoint) {
@ -125,6 +143,12 @@ class Branch extends TextBuiltin {
} }
} }
/**
* Move or rename a branch
*
* @param currentAndNew
* the current and the new branch name
*/
@Option(name = "--move", aliases = { @Option(name = "--move", aliases = {
"-m" }, metaVar = "metaVar_oldNewBranchNames", usage = "usage_moveRenameABranch", handler = OptionWithValuesListHandler.class) "-m" }, metaVar = "metaVar_oldNewBranchNames", usage = "usage_moveRenameABranch", handler = OptionWithValuesListHandler.class)
public void moveRename(List<String> currentAndNew) { public void moveRename(List<String> currentAndNew) {
@ -156,6 +180,7 @@ class Branch extends TextBuiltin {
private int maxNameLength; private int maxNameLength;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (delete != null || deleteForce != null) { if (delete != null || deleteForce != null) {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java

@ -80,6 +80,7 @@ class Checkout extends TextBuiltin {
@Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class)
private List<String> paths = new ArrayList<>(); private List<String> paths = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (createBranch) { if (createBranch) {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clean.java

@ -62,6 +62,7 @@ class Clean extends TextBuiltin {
@Option(name = "--dryRun", aliases = { "-n" }) @Option(name = "--dryRun", aliases = { "-n" })
private boolean dryRun = false; private boolean dryRun = false;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -86,11 +86,13 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
@Argument(index = 1, metaVar = "metaVar_directory") @Argument(index = 1, metaVar = "metaVar_directory")
private String localName; private String localName;
/** {@inheritDoc} */
@Override @Override
protected final boolean requiresRepository() { protected final boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (localName != null && gitdir != null) if (localName != null && gitdir != null)
@ -148,6 +150,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void initializedSubmodules(Collection<String> submodules) { public void initializedSubmodules(Collection<String> submodules) {
try { try {
@ -161,6 +164,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void cloningSubmodule(String path) { public void cloningSubmodule(String path) {
try { try {
@ -172,6 +176,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void checkingOut(AnyObjectId commit, String path) { public void checkingOut(AnyObjectId commit, String path) {
try { try {

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

@ -50,7 +50,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* Annotation to document a {@link TextBuiltin}. * Annotation to document a {@link org.eclipse.jgit.pgm.TextBuiltin}.
* <p> * <p>
* This is an optional annotation for TextBuiltin subclasses and it carries * This is an optional annotation for TextBuiltin subclasses and it carries
* documentation forward into the runtime system describing what the command is * documentation forward into the runtime system describing what the command is
@ -60,6 +60,8 @@ import java.lang.annotation.Target;
@Target( { TYPE }) @Target( { TYPE })
public @interface Command { public @interface Command {
/** /**
* Get the command name
*
* @return name the command is invoked as from the command line. If the * @return name the command is invoked as from the command line. If the
* (default) empty string is supplied the name will be generated * (default) empty string is supplied the name will be generated
* from the class name. * from the class name.
@ -67,11 +69,15 @@ public @interface Command {
public String name() default ""; public String name() default "";
/** /**
* Get command description
*
* @return one line description of the command's feature set. * @return one line description of the command's feature set.
*/ */
public String usage() default ""; public String usage() default "";
/** /**
* If this command is considered to be commonly used
*
* @return true if this command is considered to be commonly used. * @return true if this command is considered to be commonly used.
*/ */
public boolean common() default false; public boolean common() default false;

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

@ -60,9 +60,10 @@ import java.util.Vector;
/** /**
* List of all commands known by jgit's command line tools. * List of all commands known by jgit's command line tools.
* <p> * <p>
* Commands are implementations of {@link TextBuiltin}, with an optional * Commands are implementations of {@link org.eclipse.jgit.pgm.TextBuiltin},
* {@link Command} class annotation to insert additional documentation or * with an optional {@link org.eclipse.jgit.pgm.Command} class annotation to
* override the default command name (which is guessed from the class name). * insert additional documentation or override the default command name (which
* is guessed from the class name).
* <p> * <p>
* Commands may be registered by adding them to a services file in the same JAR * Commands may be registered by adding them to a services file in the same JAR
* (or classes directory) as the command implementation. The service file name * (or classes directory) as the command implementation. The service file name
@ -90,6 +91,8 @@ public class CommandCatalog {
} }
/** /**
* Get all commands sorted by their name
*
* @return all known commands, sorted by command name. * @return all known commands, sorted by command name.
*/ */
public static CommandRef[] all() { public static CommandRef[] all() {
@ -97,6 +100,8 @@ public class CommandCatalog {
} }
/** /**
* Get all common commands sorted by their name
*
* @return all common commands, sorted by command name. * @return all common commands, sorted by command name.
*/ */
public static CommandRef[] common() { public static CommandRef[] common() {

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

@ -50,7 +50,8 @@ import java.text.MessageFormat;
import org.eclipse.jgit.pgm.internal.CLIText; import org.eclipse.jgit.pgm.internal.CLIText;
/** /**
* Description of a command (a {@link TextBuiltin} subclass. * Description of a command (a {@link org.eclipse.jgit.pgm.TextBuiltin}
* subclass).
* <p> * <p>
* These descriptions are lightweight compared to creating a command instance * These descriptions are lightweight compared to creating a command instance
* and are therefore suitable for catalogs of "known" commands without linking * and are therefore suitable for catalogs of "known" commands without linking
@ -102,6 +103,8 @@ public class CommandRef {
} }
/** /**
* Get the <code>name</code>.
*
* @return name the command is invoked as from the command line. * @return name the command is invoked as from the command line.
*/ */
public String getName() { public String getName() {
@ -109,6 +112,8 @@ public class CommandRef {
} }
/** /**
* Get <code>usage</code>.
*
* @return one line description of the command's feature set. * @return one line description of the command's feature set.
*/ */
public String getUsage() { public String getUsage() {
@ -116,6 +121,8 @@ public class CommandRef {
} }
/** /**
* Is this command commonly used
*
* @return true if this command is considered to be commonly used. * @return true if this command is considered to be commonly used.
*/ */
public boolean isCommon() { public boolean isCommon() {
@ -123,6 +130,8 @@ public class CommandRef {
} }
/** /**
* Get implementation class name
*
* @return name of the Java class which implements this command. * @return name of the Java class which implements this command.
*/ */
public String getImplementationClassName() { public String getImplementationClassName() {
@ -130,6 +139,8 @@ public class CommandRef {
} }
/** /**
* Get implementation class loader
*
* @return loader for {@link #getImplementationClassName()}. * @return loader for {@link #getImplementationClassName()}.
*/ */
public ClassLoader getImplementationClassLoader() { public ClassLoader getImplementationClassLoader() {
@ -137,6 +148,8 @@ public class CommandRef {
} }
/** /**
* Create an instance of the command implementation
*
* @return a new instance of the command implementation. * @return a new instance of the command implementation.
*/ */
public TextBuiltin create() { public TextBuiltin create() {
@ -166,6 +179,7 @@ public class CommandRef {
return r; return r;
} }
/** {@inheritDoc} */
@SuppressWarnings("nls") @SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {

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

@ -77,6 +77,7 @@ class Commit extends TextBuiltin {
@Argument(metaVar = "metaVar_commitPaths", usage = "usage_CommitPaths") @Argument(metaVar = "metaVar_commitPaths", usage = "usage_CommitPaths")
private List<String> paths = new ArrayList<>(); private List<String> paths = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws NoHeadException, NoMessageException, protected void run() throws NoHeadException, NoMessageException,
ConcurrentRefUpdateException, JGitInternalException, Exception { ConcurrentRefUpdateException, JGitInternalException, Exception {

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

@ -68,6 +68,7 @@ class Config extends TextBuiltin {
@Option(name = "--file", aliases = { "-f" }, metaVar = "metaVar_file", usage = "usage_configFile") @Option(name = "--file", aliases = { "-f" }, metaVar = "metaVar_file", usage = "usage_configFile")
private File configFile; private File configFile;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (list) if (list)

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

@ -111,11 +111,13 @@ class Daemon extends TextBuiltin {
@Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport") @Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport")
List<File> directory = new ArrayList<>(); List<File> directory = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
PackConfig packConfig = new PackConfig(); PackConfig packConfig = new PackConfig();

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java

@ -65,6 +65,7 @@ class Describe extends TextBuiltin {
@Option(name = "--match", usage = "usage_Match", metaVar = "metaVar_pattern") @Option(name = "--match", usage = "usage_Match", metaVar = "metaVar_pattern")
private List<String> patterns = new ArrayList<>(); private List<String> patterns = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

3
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java

@ -45,7 +45,8 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
/** /**
* Indicates a {@link TextBuiltin} implementation has failed during execution. * Indicates a {@link org.eclipse.jgit.pgm.TextBuiltin} implementation has
* failed during execution.
* <p> * <p>
* Typically the stack trace for a Die exception is not shown to the user as it * Typically the stack trace for a Die exception is not shown to the user as it
* may indicate a simple error condition that the end-user can fix on their own, * may indicate a simple error condition that the end-user can fix on their own,

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

@ -168,12 +168,14 @@ class Diff extends TextBuiltin {
// END -- Options shared with Log // END -- Options shared with Log
/** {@inheritDoc} */
@Override @Override
protected void init(final Repository repository, final String gitDir) { protected void init(final Repository repository, final String gitDir) {
super.init(repository, gitDir); super.init(repository, gitDir);
diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); diffFmt = new DiffFormatter(new BufferedOutputStream(outs));
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
diffFmt.setRepository(db); diffFmt.setRepository(db);

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

@ -72,6 +72,7 @@ class DiffTree extends TextBuiltin {
@Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class) @Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class)
private TreeFilter pathFilter = TreeFilter.ALL; private TreeFilter pathFilter = TreeFilter.ALL;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (final TreeWalk walk = new TreeWalk(db)) { try (final TreeWalk walk = new TreeWalk(db)) {

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

@ -131,6 +131,7 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback {
@Argument(index = 1, metaVar = "metaVar_refspec") @Argument(index = 1, metaVar = "metaVar_refspec")
private List<RefSpec> toget; private List<RefSpec> toget;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {
@ -164,6 +165,7 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void fetchingSubmodule(String name) { public void fetchingSubmodule(String name) {
try { try {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java

@ -58,6 +58,7 @@ class Gc extends TextBuiltin {
@Option(name = "--prune-preserved", usage = "usage_PrunePreserved") @Option(name = "--prune-preserved", usage = "usage_PrunePreserved")
private boolean prunePreserved; private boolean prunePreserved;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
Git git = Git.wrap(db); Git git = Git.wrap(db);

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

@ -102,6 +102,7 @@ class Glog extends RevWalkTextBuiltin {
frame.getContentPane().add(world); frame.getContentPane().add(world);
} }
/** {@inheritDoc} */
@Override @Override
protected int walkLoop() throws Exception { protected int walkLoop() throws Exception {
graphPane.getCommitList().source(walk); graphPane.getCommitList().source(walk);
@ -113,11 +114,13 @@ class Glog extends RevWalkTextBuiltin {
return graphPane.getCommitList().size(); return graphPane.getCommitList().size();
} }
/** {@inheritDoc} */
@Override @Override
protected void show(final RevCommit c) throws Exception { protected void show(final RevCommit c) throws Exception {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/** {@inheritDoc} */
@Override @Override
protected RevWalk createWalk() { protected RevWalk createWalk() {
if (objects) if (objects)

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

@ -60,6 +60,7 @@ class IndexPack extends TextBuiltin {
@Option(name = "--index-version", usage = "usage_indexFileFormatToCreate") @Option(name = "--index-version", usage = "usage_indexFileFormatToCreate")
private int indexVersion = -1; private int indexVersion = -1;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
BufferedInputStream in = new BufferedInputStream(ins); BufferedInputStream in = new BufferedInputStream(ins);

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

@ -66,11 +66,13 @@ class Init extends TextBuiltin {
@Argument(index = 0, metaVar = "metaVar_directory") @Argument(index = 0, metaVar = "metaVar_directory")
private String directory; private String directory;
/** {@inheritDoc} */
@Override @Override
protected final boolean requiresRepository() { protected final boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
InitCommand command = Git.init(); InitCommand command = Git.init();

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

@ -184,12 +184,14 @@ class Log extends RevWalkTextBuiltin {
dateFormatter = new GitDateFormatter(Format.DEFAULT); dateFormatter = new GitDateFormatter(Format.DEFAULT);
} }
/** {@inheritDoc} */
@Override @Override
protected void init(final Repository repository, final String gitDir) { protected void init(final Repository repository, final String gitDir) {
super.init(repository, gitDir); super.init(repository, gitDir);
diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); diffFmt = new DiffFormatter(new BufferedOutputStream(outs));
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
diffFmt.setRepository(db); diffFmt.setRepository(db);
@ -237,6 +239,7 @@ class Log extends RevWalkTextBuiltin {
NoteMap.read(argWalk.getObjectReader(), notesCommit)); NoteMap.read(argWalk.getObjectReader(), notesCommit));
} }
/** {@inheritDoc} */
@Override @Override
protected void show(final RevCommit c) throws Exception { protected void show(final RevCommit c) throws Exception {
outw.print(CLIText.get().commitLabel); outw.print(CLIText.get().commitLabel);

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

@ -70,6 +70,7 @@ class LsRemote extends TextBuiltin {
@Argument(index = 0, metaVar = "metaVar_uriish", required = true) @Argument(index = 0, metaVar = "metaVar_uriish", required = true)
private String remote; private String remote;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote) LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote)
@ -89,6 +90,7 @@ class LsRemote extends TextBuiltin {
} }
} }
/** {@inheritDoc} */
@Override @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
return false; return false;

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

@ -70,6 +70,7 @@ class LsTree extends TextBuiltin {
@Option(name = "--", metaVar = "metaVar_paths", handler = StopOptionHandler.class) @Option(name = "--", metaVar = "metaVar_paths", handler = StopOptionHandler.class)
private List<String> paths = new ArrayList<>(); private List<String> paths = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (final TreeWalk walk = new TreeWalk(db)) { try (final TreeWalk walk = new TreeWalk(db)) {

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

@ -80,7 +80,9 @@ import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.kohsuke.args4j.OptionHandlerFilter; import org.kohsuke.args4j.OptionHandlerFilter;
/** Command line entry point. */ /**
* Command line entry point.
*/
public class Main { public class Main {
@Option(name = "--help", usage = "usage_displayThisHelpText", aliases = { "-h" }) @Option(name = "--help", usage = "usage_displayThisHelpText", aliases = { "-h" })
private boolean help; private boolean help;
@ -105,7 +107,7 @@ public class Main {
private ExecutorService gcExecutor; private ExecutorService gcExecutor;
/** /**
* * <p>Constructor for Main.</p>
*/ */
public Main() { public Main() {
HttpTransport.setConnectionFactory(new HttpClientConnectionFactory()); HttpTransport.setConnectionFactory(new HttpClientConnectionFactory());
@ -129,7 +131,7 @@ public class Main {
* *
* @param argv * @param argv
* arguments. * arguments.
* @throws Exception * @throws java.lang.Exception
*/ */
public static void main(final String[] argv) throws Exception { public static void main(final String[] argv) throws Exception {
new Main().run(argv); new Main().run(argv);
@ -150,7 +152,7 @@ public class Main {
* *
* @param argv * @param argv
* arguments. * arguments.
* @throws Exception * @throws java.lang.Exception
*/ */
protected void run(final String[] argv) throws Exception { protected void run(final String[] argv) throws Exception {
writer = createErrorWriter(); writer = createErrorWriter();
@ -309,7 +311,7 @@ public class Main {
* the {@code --git-dir} option given on the command line. May be * the {@code --git-dir} option given on the command line. May be
* null if it was not supplied. * null if it was not supplied.
* @return the repository to operate on. * @return the repository to operate on.
* @throws IOException * @throws java.io.IOException
* the repository cannot be opened. * the repository cannot be opened.
*/ */
protected Repository openGitDir(String aGitdir) throws IOException { protected Repository openGitDir(String aGitdir) throws IOException {

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

@ -101,6 +101,7 @@ class Merge extends TextBuiltin {
@Option(name = "-m", usage = "usage_message") @Option(name = "-m", usage = "usage_message")
private String message; private String message;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (squash && ff == FastForwardMode.NO_FF) if (squash && ff == FastForwardMode.NO_FF)

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

@ -65,6 +65,7 @@ class MergeBase extends TextBuiltin {
@Argument(index = 1, metaVar = "metaVar_commitish", required = true) @Argument(index = 1, metaVar = "metaVar_commitish", required = true)
private List<RevCommit> commits = new ArrayList<>(); private List<RevCommit> commits = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
for (final RevCommit c : commits) for (final RevCommit c : commits)

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

@ -113,6 +113,7 @@ class Push extends TextBuiltin {
private boolean shownURI; private boolean shownURI;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -58,11 +58,13 @@ class ReceivePack extends TextBuiltin {
@Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReceiveInto") @Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReceiveInto")
File dstGitdir; File dstGitdir;
/** {@inheritDoc} */
@Override @Override
protected final boolean requiresRepository() { protected final boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final org.eclipse.jgit.transport.ReceivePack rp; final org.eclipse.jgit.transport.ReceivePack rp;

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

@ -57,6 +57,7 @@ class Reflog extends TextBuiltin {
@Argument(metaVar = "metaVar_ref") @Argument(metaVar = "metaVar_ref")
private String ref; private String ref;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -84,6 +84,7 @@ class Remote extends TextBuiltin {
@Argument(index = 2, metaVar = "metaVar_uriish") @Argument(index = 2, metaVar = "metaVar_uriish")
private String uri; private String uri;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {
@ -143,6 +144,7 @@ class Remote extends TextBuiltin {
} }
} }
/** {@inheritDoc} */
@Override @Override
public void printUsage(final String message, final CmdLineParser clp) public void printUsage(final String message, final CmdLineParser clp)
throws IOException { throws IOException {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java

@ -58,6 +58,7 @@ class Repo extends TextBuiltin {
@Argument(required = true, metaVar = "metaVar_path", usage = "usage_pathToXml") @Argument(required = true, metaVar = "metaVar_path", usage = "usage_pathToXml")
private String path; private String path;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
new RepoCommand(db) new RepoCommand(db)

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java

@ -72,6 +72,7 @@ class Reset extends TextBuiltin {
@Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class)
private List<String> paths = new ArrayList<>(); private List<String> paths = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -51,6 +51,7 @@ import org.eclipse.jgit.revwalk.RevTree;
@Command(usage = "usage_RevList") @Command(usage = "usage_RevList")
class RevList extends RevWalkTextBuiltin { class RevList extends RevWalkTextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void show(final RevCommit c) throws Exception { protected void show(final RevCommit c) throws Exception {
if (c.has(RevFlag.UNINTERESTING)) if (c.has(RevFlag.UNINTERESTING))
@ -64,6 +65,7 @@ class RevList extends RevWalkTextBuiltin {
outw.println(); outw.println();
} }
/** {@inheritDoc} */
@Override @Override
protected void show(final ObjectWalk ow, final RevObject obj) protected void show(final ObjectWalk ow, final RevObject obj)
throws Exception { throws Exception {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java

@ -70,6 +70,7 @@ class RevParse extends TextBuiltin {
@Argument(index = 0, metaVar = "metaVar_commitish") @Argument(index = 0, metaVar = "metaVar_commitish")
private List<ObjectId> commits = new ArrayList<>(); private List<ObjectId> commits = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (all) { if (all) {

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

@ -149,6 +149,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
@Option(name = "--max-count", aliases = "-n", metaVar = "metaVar_n") @Option(name = "--max-count", aliases = "-n", metaVar = "metaVar_n")
private int maxCount = -1; private int maxCount = -1;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
walk = createWalk(); walk = createWalk();
@ -210,6 +211,11 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
} }
} }
/**
* Create RevWalk
*
* @return a {@link org.eclipse.jgit.revwalk.RevWalk} object.
*/
protected RevWalk createWalk() { protected RevWalk createWalk() {
RevWalk result; RevWalk result;
if (objects) if (objects)
@ -222,6 +228,13 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
return result; return result;
} }
/**
* Loop the walk
*
* @return number of RevCommits walked
* @throws java.lang.Exception
* if any.
*/
protected int walkLoop() throws Exception { protected int walkLoop() throws Exception {
int n = 0; int n = 0;
for (final RevCommit c : walk) { for (final RevCommit c : walk) {
@ -248,8 +261,8 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
* RevWalkTextBuiltin. * RevWalkTextBuiltin.
* *
* @param c * @param c
* The current {@link RevCommit} * The current {@link org.eclipse.jgit.revwalk.RevCommit}
* @throws Exception * @throws java.lang.Exception
*/ */
protected abstract void show(final RevCommit c) throws Exception; protected abstract void show(final RevCommit c) throws Exception;
@ -260,10 +273,11 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
* process RevCommits. * process RevCommits.
* *
* @param objectWalk * @param objectWalk
* the {@link ObjectWalk} used by {@link #walkLoop()} * the {@link org.eclipse.jgit.revwalk.ObjectWalk} used by
* {@link #walkLoop()}
* @param currentObject * @param currentObject
* The current {@link RevObject} * The current {@link org.eclipse.jgit.revwalk.RevObject}
* @throws Exception * @throws java.lang.Exception
*/ */
protected void show(final ObjectWalk objectWalk, protected void show(final ObjectWalk objectWalk,
final RevObject currentObject) throws Exception { final RevObject currentObject) throws Exception {

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

@ -59,6 +59,7 @@ class Rm extends TextBuiltin {
@Option(name = "--", handler = StopOptionHandler.class) @Option(name = "--", handler = StopOptionHandler.class)
private List<String> paths = new ArrayList<>(); private List<String> paths = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -165,12 +165,14 @@ class Show extends TextBuiltin {
fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$ fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$
} }
/** {@inheritDoc} */
@Override @Override
protected void init(final Repository repository, final String gitDir) { protected void init(final Repository repository, final String gitDir) {
super.init(repository, gitDir); super.init(repository, gitDir);
diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); diffFmt = new DiffFormatter(new BufferedOutputStream(outs));
} }
/** {@inheritDoc} */
@SuppressWarnings("boxing") @SuppressWarnings("boxing")
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {

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

@ -58,6 +58,7 @@ import org.eclipse.jgit.util.RefMap;
@Command(usage = "usage_ShowRef") @Command(usage = "usage_ShowRef")
class ShowRef extends TextBuiltin { class ShowRef extends TextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
for (final Ref r : getSortedRefs()) { for (final Ref r : getSortedRefs()) {

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

@ -86,6 +86,7 @@ class Status extends TextBuiltin {
@Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class)
protected List<String> filterPaths; protected List<String> filterPaths;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {
@ -261,6 +262,15 @@ class Status extends TextBuiltin {
} }
} }
/**
* Print section header
*
* @param pattern
* a {@link java.lang.String} object.
* @param arguments
* a {@link java.lang.Object} object.
* @throws java.io.IOException
*/
protected void printSectionHeader(String pattern, Object... arguments) protected void printSectionHeader(String pattern, Object... arguments)
throws IOException { throws IOException {
if (!porcelain) { if (!porcelain) {
@ -272,6 +282,14 @@ class Status extends TextBuiltin {
} }
} }
/**
* Print String list
*
* @param list
* a {@link java.util.Collection} object.
* @return a int.
* @throws java.io.IOException
*/
protected int printList(Collection<String> list) throws IOException { protected int printList(Collection<String> list) throws IOException {
if (!list.isEmpty()) { if (!list.isEmpty()) {
List<String> sortedList = new ArrayList<>(list); List<String> sortedList = new ArrayList<>(list);
@ -286,6 +304,26 @@ class Status extends TextBuiltin {
return 0; return 0;
} }
/**
* Print String list
*
* @param status1
* a {@link java.lang.String} object.
* @param status2
* a {@link java.lang.String} object.
* @param status3
* a {@link java.lang.String} object.
* @param list
* a {@link java.util.Collection} object.
* @param set1
* a {@link java.util.Collection} object.
* @param set2
* a {@link java.util.Collection} object.
* @param set3
* a {@link java.util.Collection} object.
* @return a int.
* @throws java.io.IOException
*/
protected int printList(String status1, String status2, String status3, protected int printList(String status1, String status2, String status3,
Collection<String> list, Collection<String> set1, Collection<String> list, Collection<String> set1,
Collection<String> set2, Collection<String> set2,

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

@ -80,6 +80,7 @@ class Tag extends TextBuiltin {
@Argument(index = 1, metaVar = "metaVar_object") @Argument(index = 1, metaVar = "metaVar_object")
private ObjectId object; private ObjectId object;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (Git git = new Git(db)) { try (Git git = new Git(db)) {

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

@ -133,7 +133,11 @@ public abstract class TextBuiltin {
commandName = name; commandName = name;
} }
/** @return true if {@link #db}/{@link #getRepository()} is required. */ /**
* If this command requires a repository.
*
* @return true if {@link #db}/{@link #getRepository()} is required
*/
protected boolean requiresRepository() { protected boolean requiresRepository() {
return true; return true;
} }
@ -214,7 +218,7 @@ public abstract class TextBuiltin {
* *
* @param args * @param args
* command line arguments passed after the command name. * command line arguments passed after the command name.
* @throws Exception * @throws java.lang.Exception
* an error occurred while processing the command. The main * an error occurred while processing the command. The main
* framework will catch the exception and print a message on * framework will catch the exception and print a message on
* standard error. * standard error.
@ -233,7 +237,7 @@ public abstract class TextBuiltin {
* *
* @param args * @param args
* the arguments supplied on the command line, if any. * the arguments supplied on the command line, if any.
* @throws IOException * @throws java.io.IOException
*/ */
protected void parseArguments(final String[] args) throws IOException { protected void parseArguments(final String[] args) throws IOException {
final CmdLineParser clp = new CmdLineParser(this); final CmdLineParser clp = new CmdLineParser(this);
@ -260,7 +264,8 @@ public abstract class TextBuiltin {
* Print the usage line * Print the usage line
* *
* @param clp * @param clp
* @throws IOException * a {@link org.eclipse.jgit.pgm.opt.CmdLineParser} object.
* @throws java.io.IOException
*/ */
public void printUsageAndExit(final CmdLineParser clp) throws IOException { public void printUsageAndExit(final CmdLineParser clp) throws IOException {
printUsageAndExit("", clp); //$NON-NLS-1$ printUsageAndExit("", clp); //$NON-NLS-1$
@ -270,8 +275,10 @@ public abstract class TextBuiltin {
* Print an error message and the usage line * Print an error message and the usage line
* *
* @param message * @param message
* a {@link java.lang.String} object.
* @param clp * @param clp
* @throws IOException * a {@link org.eclipse.jgit.pgm.opt.CmdLineParser} object.
* @throws java.io.IOException
*/ */
public void printUsageAndExit(final String message, final CmdLineParser clp) throws IOException { public void printUsageAndExit(final String message, final CmdLineParser clp) throws IOException {
printUsage(message, clp); printUsage(message, clp);
@ -279,11 +286,13 @@ public abstract class TextBuiltin {
} }
/** /**
* Print usage help text.
*
* @param message * @param message
* non null * non null
* @param clp * @param clp
* parser used to print options * parser used to print options
* @throws IOException * @throws java.io.IOException
* @since 4.2 * @since 4.2
*/ */
protected void printUsage(final String message, final CmdLineParser clp) protected void printUsage(final String message, final CmdLineParser clp)
@ -302,6 +311,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Get error writer
*
* @return error writer, typically this is standard error. * @return error writer, typically this is standard error.
* @since 4.2 * @since 4.2
*/ */
@ -310,6 +321,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Get output writer
*
* @return output writer, typically this is standard output. * @return output writer, typically this is standard output.
* @since 4.9 * @since 4.9
*/ */
@ -318,6 +331,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Get resource bundle with localized texts
*
* @return the resource bundle that will be passed to args4j for purpose of * @return the resource bundle that will be passed to args4j for purpose of
* string localization * string localization
*/ */
@ -330,7 +345,7 @@ public abstract class TextBuiltin {
* <p> * <p>
* This method should only be invoked by {@link #execute(String[])}. * This method should only be invoked by {@link #execute(String[])}.
* *
* @throws Exception * @throws java.lang.Exception
* an error occurred while processing the command. The main * an error occurred while processing the command. The main
* framework will catch the exception and print a message on * framework will catch the exception and print a message on
* standard error. * standard error.
@ -338,6 +353,8 @@ public abstract class TextBuiltin {
protected abstract void run() throws Exception; protected abstract void run() throws Exception;
/** /**
* Get the repository
*
* @return the repository this command accesses. * @return the repository this command accesses.
*/ */
public Repository getRepository() { public Repository getRepository() {
@ -352,6 +369,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Exit the command with an error message
*
* @param why * @param why
* textual explanation * textual explanation
* @return a runtime exception the caller is expected to throw * @return a runtime exception the caller is expected to throw
@ -361,6 +380,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Exit the command with an error message and an exception
*
* @param why * @param why
* textual explanation * textual explanation
* @param cause * @param cause
@ -372,8 +393,11 @@ public abstract class TextBuiltin {
} }
/** /**
* Exit the command
*
* @param aborted * @param aborted
* boolean indicating that the execution has been aborted before running * boolean indicating that the execution has been aborted before
* running
* @return a runtime exception the caller is expected to throw * @return a runtime exception the caller is expected to throw
* @since 3.4 * @since 3.4
*/ */
@ -382,6 +406,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Exit the command
*
* @param aborted * @param aborted
* boolean indicating that the execution has been aborted before * boolean indicating that the execution has been aborted before
* running * running
@ -405,6 +431,8 @@ public abstract class TextBuiltin {
} }
/** /**
* Check if the arguments contain a help option
*
* @param args * @param args
* non null * non null
* @return true if the given array contains help option * @return true if the given array contains help option

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

@ -62,11 +62,13 @@ class UploadPack extends TextBuiltin {
@Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReadFrom") @Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReadFrom")
File srcGitdir; File srcGitdir;
/** {@inheritDoc} */
@Override @Override
protected final boolean requiresRepository() { protected final boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final org.eclipse.jgit.transport.UploadPack up; final org.eclipse.jgit.transport.UploadPack up;

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

@ -55,6 +55,7 @@ import org.eclipse.jgit.pgm.internal.CLIText;
@Command(common = true, usage = "usage_DisplayTheVersionOfJgit") @Command(common = true, usage = "usage_DisplayTheVersionOfJgit")
class Version extends TextBuiltin { class Version extends TextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
// read the Implementation-Version from Manifest // read the Implementation-Version from Manifest
@ -73,6 +74,7 @@ class Version extends TextBuiltin {
outw.println(MessageFormat.format(CLIText.get().jgitVersion, version)); outw.println(MessageFormat.format(CLIText.get().jgitVersion, version));
} }
/** {@inheritDoc} */
@Override @Override
protected final boolean requiresRepository() { protected final boolean requiresRepository() {
return false; return false;

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java

@ -95,6 +95,7 @@ class BenchmarkReftable extends TextBuiltin {
@Argument(index = 1) @Argument(index = 1)
private String reftablePath; private String reftablePath;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
switch (test) { switch (test) {

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

@ -130,11 +130,13 @@ class DiffAlgorithms extends TextBuiltin {
private ThreadMXBean mxBean; private ThreadMXBean mxBean;
/** {@inheritDoc} */
@Override @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
mxBean = ManagementFactory.getThreadMXBean(); mxBean = ManagementFactory.getThreadMXBean();

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

@ -214,11 +214,13 @@ class LfsStore extends TextBuiltin {
String secretKey; String secretKey;
/** {@inheritDoc} */
@Override @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
AppServer server = new AppServer(port); AppServer server = new AppServer(port);

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

@ -57,6 +57,7 @@ import org.eclipse.jgit.pgm.internal.CLIText;
@Command(usage = "usage_MakeCacheTree") @Command(usage = "usage_MakeCacheTree")
class MakeCacheTree extends TextBuiltin { class MakeCacheTree extends TextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final DirCache cache = db.readDirCache(); final DirCache cache = db.readDirCache();

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

@ -54,6 +54,7 @@ import org.eclipse.jgit.pgm.internal.CLIText;
@Command(usage = "usage_ReadDirCache") @Command(usage = "usage_ReadDirCache")
class ReadDirCache extends TextBuiltin { class ReadDirCache extends TextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final int cnt = 100; final int cnt = 100;

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadReftable.java

@ -63,6 +63,7 @@ class ReadReftable extends TextBuiltin {
@Argument(index = 1, required = false) @Argument(index = 1, required = false)
private String ref; private String ref;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (FileInputStream in = new FileInputStream(input); try (FileInputStream in = new FileInputStream(input);

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

@ -114,6 +114,7 @@ class RebuildCommitGraph extends TextBuiltin {
private Map<ObjectId, ObjectId> rewrites = new HashMap<>(); private Map<ObjectId, ObjectId> rewrites = new HashMap<>();
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (!really && !db.getRefDatabase().getRefs(ALL).isEmpty()) { if (!really && !db.getRefDatabase().getRefs(ALL).isEmpty()) {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java

@ -73,6 +73,7 @@ class RebuildRefTree extends TextBuiltin {
private String txnNamespace; private String txnNamespace;
private String txnCommitted; private String txnCommitted;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
try (ObjectReader reader = db.newObjectReader(); try (ObjectReader reader = db.newObjectReader();

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

@ -57,6 +57,7 @@ import org.eclipse.jgit.pgm.internal.CLIText;
@Command(usage = "usage_ShowCacheTree") @Command(usage = "usage_ShowCacheTree")
class ShowCacheTree extends TextBuiltin { class ShowCacheTree extends TextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final DirCache cache = db.readDirCache(); final DirCache cache = db.readDirCache();

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

@ -59,6 +59,7 @@ class ShowCommands extends TextBuiltin {
@Option(name = "--pretty", metaVar = "metaVar_commandDetail", usage = "usage_alterTheDetailShown") @Option(name = "--pretty", metaVar = "metaVar_commandDetail", usage = "usage_alterTheDetailShown")
private Format pretty = Format.USAGE; private Format pretty = Format.USAGE;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final CommandRef[] list = CommandCatalog.all(); final CommandRef[] list = CommandCatalog.all();

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

@ -64,6 +64,7 @@ class ShowDirCache extends TextBuiltin {
@Option(name = "--millis", aliases = { "-m" }, usage = "usage_showTimeInMilliseconds") @Option(name = "--millis", aliases = { "-m" }, usage = "usage_showTimeInMilliseconds")
private boolean millis = false; private boolean millis = false;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final SimpleDateFormat fmt; final SimpleDateFormat fmt;

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java

@ -72,6 +72,7 @@ class ShowPackDelta extends TextBuiltin {
@Argument(index = 0) @Argument(index = 0)
private ObjectId objectId; private ObjectId objectId;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
ObjectReader reader = db.newObjectReader(); ObjectReader reader = db.newObjectReader();

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

@ -262,11 +262,13 @@ class TextHashFunctions extends TextBuiltin {
@Option(name = "--repository", aliases = { "-r" }, metaVar = "GIT_DIR", usage = "Repository to scan") @Option(name = "--repository", aliases = { "-r" }, metaVar = "GIT_DIR", usage = "Repository to scan")
List<File> gitDirs = new ArrayList<>(); List<File> gitDirs = new ArrayList<>();
/** {@inheritDoc} */
@Override @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
if (gitDirs.isEmpty()) { if (gitDirs.isEmpty()) {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java

@ -75,6 +75,7 @@ class VerifyReftable extends TextBuiltin {
@Argument(index = 1) @Argument(index = 1)
private String reftablePath; private String reftablePath;
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
List<Ref> refs = WriteReftable.readRefs(lsRemotePath); List<Ref> refs = WriteReftable.readRefs(lsRemotePath);

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

@ -51,6 +51,7 @@ import org.eclipse.jgit.pgm.internal.CLIText;
@Command(usage = "usage_WriteDirCache") @Command(usage = "usage_WriteDirCache")
class WriteDirCache extends TextBuiltin { class WriteDirCache extends TextBuiltin {
/** {@inheritDoc} */
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {
final DirCache cache = db.readDirCache(); final DirCache cache = db.readDirCache();

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java

@ -104,6 +104,7 @@ class WriteReftable extends TextBuiltin {
@Argument(index = 1) @Argument(index = 1)
private String out; private String out;
/** {@inheritDoc} */
@SuppressWarnings({ "nls", "boxing" }) @SuppressWarnings({ "nls", "boxing" })
@Override @Override
protected void run() throws Exception { protected void run() throws Exception {

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java

@ -79,6 +79,8 @@ public class CLIText extends TranslationBundle {
} }
/** /**
* Format text
*
* @param text * @param text
* the text to format. * the text to format.
* @return a new Format instance. * @return a new Format instance.
@ -88,6 +90,8 @@ public class CLIText extends TranslationBundle {
} }
/** /**
* Get an instance of this translation bundle
*
* @return an instance of this translation bundle * @return an instance of this translation bundle
*/ */
public static CLIText get() { public static CLIText get() {

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

@ -68,7 +68,8 @@ import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
/** /**
* Custom argument handler {@link AbstractTreeIterator} from string values. * Custom argument handler
* {@link org.eclipse.jgit.treewalk.AbstractTreeIterator} from string values.
* <p> * <p>
* Assumes the parser has been initialized with a Repository. * Assumes the parser has been initialized with a Repository.
*/ */
@ -82,8 +83,11 @@ public class AbstractTreeIteratorHandler extends
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public AbstractTreeIteratorHandler(final CmdLineParser parser, public AbstractTreeIteratorHandler(final CmdLineParser parser,
final OptionDef option, final OptionDef option,
@ -92,6 +96,7 @@ public class AbstractTreeIteratorHandler extends
clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser;
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
final String name = params.getParameter(0); final String name = params.getParameter(0);
@ -144,6 +149,7 @@ public class AbstractTreeIteratorHandler extends
return 1; return 1;
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_treeish; return CLIText.get().metaVar_treeish;

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

@ -61,11 +61,9 @@ import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.treewalk.AbstractTreeIterator; import org.eclipse.jgit.treewalk.AbstractTreeIterator;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.IllegalAnnotationError; import org.kohsuke.args4j.IllegalAnnotationError;
import org.kohsuke.args4j.NamedOptionDef; import org.kohsuke.args4j.NamedOptionDef;
import org.kohsuke.args4j.Option;
import org.kohsuke.args4j.OptionDef; import org.kohsuke.args4j.OptionDef;
import org.kohsuke.args4j.OptionHandlerRegistry; import org.kohsuke.args4j.OptionHandlerRegistry;
import org.kohsuke.args4j.spi.OptionHandler; import org.kohsuke.args4j.spi.OptionHandler;
@ -105,9 +103,10 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
* them into the given object. * them into the given object.
* *
* @param bean * @param bean
* instance of a class annotated by {@link Option} and * instance of a class annotated by
* {@link Argument}. this object will receive values. * {@link org.kohsuke.args4j.Option} and
* * {@link org.kohsuke.args4j.Argument}. this object will receive
* values.
* @throws IllegalAnnotationError * @throws IllegalAnnotationError
* if the option bean class is using args4j annotations * if the option bean class is using args4j annotations
* incorrectly. * incorrectly.
@ -121,8 +120,10 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
* them into the given object. * them into the given object.
* *
* @param bean * @param bean
* instance of a class annotated by {@link Option} and * instance of a class annotated by
* {@link Argument}. this object will receive values. * {@link org.kohsuke.args4j.Option} and
* {@link org.kohsuke.args4j.Argument}. this object will receive
* values.
* @param repo * @param repo
* repository this parser can translate options through. * repository this parser can translate options through.
* @throws IllegalAnnotationError * @throws IllegalAnnotationError
@ -140,6 +141,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
this.db = repo; this.db = repo;
} }
/** {@inheritDoc} */
@Override @Override
public void parseArgument(final String... args) throws CmdLineException { public void parseArgument(final String... args) throws CmdLineException {
final ArrayList<String> tmp = new ArrayList<>(args.length); final ArrayList<String> tmp = new ArrayList<>(args.length);
@ -223,6 +225,8 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
} }
/** /**
* Check if array contains help option
*
* @param args * @param args
* non null * non null
* @return true if the given array contains help option * @return true if the given array contains help option
@ -292,6 +296,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
} }
} }
/** {@inheritDoc} */
@Override @Override
protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { protected OptionHandler createOptionHandler(OptionDef o, Setter setter) {
if (o instanceof NamedOptionDef) if (o instanceof NamedOptionDef)
@ -301,6 +306,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
} }
/** {@inheritDoc} */
@Override @Override
public void printSingleLineUsage(Writer w, ResourceBundle rb) { public void printSingleLineUsage(Writer w, ResourceBundle rb) {
List<OptionHandler> options = getOptions(); List<OptionHandler> options = getOptions();

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

@ -56,7 +56,8 @@ import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
/** /**
* Custom argument handler {@link ObjectId} from string values. * Custom argument handler {@link org.eclipse.jgit.lib.ObjectId} from string
* values.
* <p> * <p>
* Assumes the parser has been initialized with a Repository. * Assumes the parser has been initialized with a Repository.
*/ */
@ -69,8 +70,11 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> {
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public ObjectIdHandler(final CmdLineParser parser, final OptionDef option, public ObjectIdHandler(final CmdLineParser parser, final OptionDef option,
final Setter<? super ObjectId> setter) { final Setter<? super ObjectId> setter) {
@ -78,6 +82,7 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> {
clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser;
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
final String name = params.getParameter(0); final String name = params.getParameter(0);
@ -96,6 +101,7 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> {
CLIText.format(CLIText.get().notAnObject), name); CLIText.format(CLIText.get().notAnObject), name);
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_object; return CLIText.get().metaVar_object;

7
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/OptionWithValuesListHandler.java

@ -19,15 +19,21 @@ import org.kohsuke.args4j.spi.Setter;
public class OptionWithValuesListHandler extends OptionHandler<List<?>> { public class OptionWithValuesListHandler extends OptionHandler<List<?>> {
/** /**
* Constructor for OptionWithValuesListHandler.
*
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public OptionWithValuesListHandler(CmdLineParser parser, public OptionWithValuesListHandler(CmdLineParser parser,
OptionDef option, Setter<List<?>> setter) { OptionDef option, Setter<List<?>> setter) {
super(parser, option, setter); super(parser, option, setter);
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(Parameters params) throws CmdLineException { public int parseArguments(Parameters params) throws CmdLineException {
final List<String> list = new ArrayList<>(); final List<String> list = new ArrayList<>();
@ -44,6 +50,7 @@ public class OptionWithValuesListHandler extends OptionHandler<List<?>> {
return list.size(); return list.size();
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_values; return CLIText.get().metaVar_values;

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

@ -59,10 +59,11 @@ import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
/** /**
* Create a {@link TreeFilter} to patch math names. * Create a {@link org.eclipse.jgit.treewalk.filter.TreeFilter} to patch math
* names.
* <p> * <p>
* This handler consumes all arguments to the end of the command line, and is * This handler consumes all arguments to the end of the command line, and is
* meant to be used on an {@link Option} of name "--". * meant to be used on an {@link org.kohsuke.args4j.Option} of name "--".
*/ */
public class PathTreeFilterHandler extends OptionHandler<TreeFilter> { public class PathTreeFilterHandler extends OptionHandler<TreeFilter> {
/** /**
@ -71,14 +72,18 @@ public class PathTreeFilterHandler extends OptionHandler<TreeFilter> {
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public PathTreeFilterHandler(final CmdLineParser parser, public PathTreeFilterHandler(final CmdLineParser parser,
final OptionDef option, final Setter<? super TreeFilter> setter) { final OptionDef option, final Setter<? super TreeFilter> setter) {
super(parser, option, setter); super(parser, option, setter);
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
final List<PathFilter> filters = new ArrayList<>(); final List<PathFilter> filters = new ArrayList<>();
@ -102,6 +107,7 @@ public class PathTreeFilterHandler extends OptionHandler<TreeFilter> {
return filters.size(); return filters.size();
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_paths; return CLIText.get().metaVar_paths;

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

@ -53,7 +53,8 @@ import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
/** /**
* Custom argument handler {@link RefSpec} from string values. * Custom argument handler {@link org.eclipse.jgit.transport.RefSpec} from
* string values.
* <p> * <p>
* Assumes the parser has been initialized with a Repository. * Assumes the parser has been initialized with a Repository.
*/ */
@ -64,20 +65,25 @@ public class RefSpecHandler extends OptionHandler<RefSpec> {
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public RefSpecHandler(final CmdLineParser parser, final OptionDef option, public RefSpecHandler(final CmdLineParser parser, final OptionDef option,
final Setter<? super RefSpec> setter) { final Setter<? super RefSpec> setter) {
super(parser, option, setter); super(parser, option, setter);
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
setter.addValue(new RefSpec(params.getParameter(0))); setter.addValue(new RefSpec(params.getParameter(0)));
return 1; return 1;
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_refspec; return CLIText.get().metaVar_refspec;

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

@ -60,7 +60,8 @@ import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
/** /**
* Custom argument handler {@link RevCommit} from string values. * Custom argument handler {@link org.eclipse.jgit.revwalk.RevCommit} from
* string values.
* <p> * <p>
* Assumes the parser has been initialized with a Repository. * Assumes the parser has been initialized with a Repository.
*/ */
@ -73,8 +74,11 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public RevCommitHandler(final CmdLineParser parser, final OptionDef option, public RevCommitHandler(final CmdLineParser parser, final OptionDef option,
final Setter<? super RevCommit> setter) { final Setter<? super RevCommit> setter) {
@ -82,6 +86,7 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser;
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
String name = params.getParameter(0); String name = params.getParameter(0);
@ -145,6 +150,7 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
setter.addValue(c); setter.addValue(c);
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_commitish; return CLIText.get().metaVar_commitish;

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

@ -59,7 +59,8 @@ import org.kohsuke.args4j.spi.Parameters;
import org.kohsuke.args4j.spi.Setter; import org.kohsuke.args4j.spi.Setter;
/** /**
* Custom argument handler {@link RevTree} from string values. * Custom argument handler {@link org.eclipse.jgit.revwalk.RevTree} from string
* values.
* <p> * <p>
* Assumes the parser has been initialized with a Repository. * Assumes the parser has been initialized with a Repository.
*/ */
@ -72,8 +73,11 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public RevTreeHandler(final CmdLineParser parser, final OptionDef option, public RevTreeHandler(final CmdLineParser parser, final OptionDef option,
final Setter<? super RevTree> setter) { final Setter<? super RevTree> setter) {
@ -81,6 +85,7 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser;
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
final String name = params.getParameter(0); final String name = params.getParameter(0);
@ -112,6 +117,7 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
return 1; return 1;
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_treeish; return CLIText.get().metaVar_treeish;

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

@ -57,8 +57,9 @@ import org.kohsuke.args4j.spi.Setter;
/** /**
* Custom Argument handler for jgit command selection. * Custom Argument handler for jgit command selection.
* <p> * <p>
* Translates a single argument string to a {@link TextBuiltin} instance which * Translates a single argument string to a
* we can execute at runtime with the remaining arguments of the parser. * {@link org.eclipse.jgit.pgm.TextBuiltin} instance which we can execute at
* runtime with the remaining arguments of the parser.
*/ */
public class SubcommandHandler extends OptionHandler<TextBuiltin> { public class SubcommandHandler extends OptionHandler<TextBuiltin> {
private final org.eclipse.jgit.pgm.opt.CmdLineParser clp; private final org.eclipse.jgit.pgm.opt.CmdLineParser clp;
@ -69,8 +70,11 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> {
* This constructor is used only by args4j. * This constructor is used only by args4j.
* *
* @param parser * @param parser
* a {@link org.kohsuke.args4j.CmdLineParser} object.
* @param option * @param option
* a {@link org.kohsuke.args4j.OptionDef} object.
* @param setter * @param setter
* a {@link org.kohsuke.args4j.spi.Setter} object.
*/ */
public SubcommandHandler(final CmdLineParser parser, public SubcommandHandler(final CmdLineParser parser,
final OptionDef option, final Setter<? super TextBuiltin> setter) { final OptionDef option, final Setter<? super TextBuiltin> setter) {
@ -78,6 +82,7 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> {
clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser;
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { public int parseArguments(final Parameters params) throws CmdLineException {
final String name = params.getParameter(0); final String name = params.getParameter(0);
@ -95,6 +100,7 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> {
return 1; return 1;
} }
/** {@inheritDoc} */
@Override @Override
public String getDefaultMetaVariable() { public String getDefaultMetaVariable() {
return CLIText.get().metaVar_command; return CLIText.get().metaVar_command;

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

@ -71,6 +71,8 @@ import org.kohsuke.args4j.spi.StringOptionHandler;
public class UntrackedFilesHandler extends StringOptionHandler { public class UntrackedFilesHandler extends StringOptionHandler {
/** /**
* <p>Constructor for UntrackedFilesHandler.</p>
*
* @param parser * @param parser
* The parser to which this handler belongs to. * The parser to which this handler belongs to.
* @param option * @param option
@ -83,6 +85,7 @@ public class UntrackedFilesHandler extends StringOptionHandler {
super(parser, option, setter); super(parser, option, setter);
} }
/** {@inheritDoc} */
@Override @Override
public int parseArguments(Parameters params) throws CmdLineException { public int parseArguments(Parameters params) throws CmdLineException {
String alias = params.getParameter(-1); String alias = params.getParameter(-1);

Loading…
Cancel
Save