Instead of using a custom argument parsing loop for each builtin subcommand we use a standard parsing library. The library can also generate help text, such as: $ jgit -h jgit --git-dir GIT_DIR --help (-h) --show-stack-trace command [ARG ...] --git-dir GIT_DIR : set the git repository to operate on --help (-h) : display this help text --show-stack-trace : display the Java stack trace on exceptions $ jgit merge-base -h jgit merge-base commit-ish commit-ish ... [--all] [--help (-h)] --all : display all possible merge bases --help (-h) : display this help text --8<-- Shawn O. Pearce (28): Fix deadlock caused by push over SSH Use die utility method in glog Add args4j library for command line switch processing Move org.spearce.jgit.pgm to its own Java project Make TextBuiltin public so other packages can implement and use it Initialize TextBuiltins with the repository before execution Define our own extended CmdLineParser for extra parsing support Add parseTree method to RevWalk to obtain a RevTree from AnyObjectId Add option handler for AbstractTreeIterator values Add option handler for ObjectId values Add option handler for PathTreeFilter values Add option handler for RefSpec values Add option handler for RevCommit values Add option handler for RevTree values Register most of our OptionHandler implementations for automatic use Convert jgit's Main to use args4j for basic parsing services Support automatic command line parsing for TextBuiltin subclasses Convert diff-tree program to args4j Convert fetch program to args4j Convert index-pack program to args4j Convert ls-remote program to args4j Convert ls-tree program to args4j Convert merge-base program to args4j Convert push program to args4j Convert show-ref program to args4j Convert tag program to args4j Convert rev-list, log, glog programs to args4j Remove support for legacy style TextBuiltins jgit.sh | 2 + make_jgit.sh | 88 +++++- org.spearce.jgit.pgm/.classpath | 8 + org.spearce.jgit.pgm/.gitignore | 1 + org.spearce.jgit.pgm/.project | 17 + .../.settings/org.eclipse.core.runtime.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 320 ++++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 9 + org.spearce.jgit.pgm/lib/args4j-2.0.9.jar | Bin 0 -> 40654 bytes org.spearce.jgit.pgm/lib/args4j-2.0.9.zip | Bin 0 -> 31516 bytes org.spearce.jgit.pgm/lib/args4j.LICENSE.txt | 32 ++ .../src/org/spearce/jgit/pgm/Die.java | 17 +- .../src/org/spearce/jgit/pgm/DiffTree.java | 57 ++-- .../src/org/spearce/jgit/pgm/Fetch.java | 27 +-- .../src/org/spearce/jgit/pgm/Glog.java | 2 +- .../src/org/spearce/jgit/pgm/IndexPack.java | 35 +-- .../src/org/spearce/jgit/pgm/Log.java | 0 .../src/org/spearce/jgit/pgm/LsRemote.java | 23 +- .../src/org/spearce/jgit/pgm/LsTree.java | 42 +-- .../src/org/spearce/jgit/pgm/Main.java | 115 +++---- .../src/org/spearce/jgit/pgm/MergeBase.java | 37 ++- .../src/org/spearce/jgit/pgm/Push.java | 99 +++---- .../src/org/spearce/jgit/pgm/RevList.java | 0 .../org/spearce/jgit/pgm/RevWalkTextBuiltin.java | 146 +++++---- .../src/org/spearce/jgit/pgm/ShowRef.java | 2 +- .../src/org/spearce/jgit/pgm/Tag.java | 79 ++--- .../src/org/spearce/jgit/pgm/TextBuiltin.java | 202 ++++++++++++ .../org/spearce/jgit/pgm/build/JarLinkUtil.java | 204 +++++++++++++ .../jgit/pgm/opt/AbstractTreeIteratorHandler.java | 121 ++++++++ .../org/spearce/jgit/pgm/opt/CmdLineParser.java | 171 +++++++++++ .../org/spearce/jgit/pgm/opt/ObjectIdHandler.java | 94 ++++++ .../jgit/pgm/opt/PathTreeFilterHandler.java | 102 +++++++ .../org/spearce/jgit/pgm/opt/RefSpecHandler.java | 63 ++-- .../org/spearce/jgit/pgm/opt/RevCommitHandler.java | 141 +++++++++ .../org/spearce/jgit/pgm/opt/RevTreeHandler.java | 109 +++++++ .../spearce/jgit/pgm/opt/SubcommandHandler.java | 149 +++++++++ .../src/org/spearce/jgit/pgm/TextBuiltin.java | 96 ------ .../src/org/spearce/jgit/revwalk/RevWalk.java | 35 +++ .../org/spearce/jgit/transport/FetchProcess.java | 2 +- .../spearce/jgit/transport/OperationResult.java | 16 +- .../org/spearce/jgit/transport/PushProcess.java | 2 +- 41 files changed, 2149 insertions(+), 519 deletions(-) create mode 100644 org.spearce.jgit.pgm/.classpath create mode 100644 org.spearce.jgit.pgm/.gitignore create mode 100644 org.spearce.jgit.pgm/.project create mode 100644 org.spearce.jgit.pgm/.settings/org.eclipse.core.runtime.prefs create mode 100644 org.spearce.jgit.pgm/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.spearce.jgit.pgm/.settings/org.eclipse.jdt.ui.prefs create mode 100644 org.spearce.jgit.pgm/lib/args4j-2.0.9.jar create mode 100644 org.spearce.jgit.pgm/lib/args4j-2.0.9.zip create mode 100644 org.spearce.jgit.pgm/lib/args4j.LICENSE.txt rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Die.java (76%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/DiffTree.java (73%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Fetch.java (89%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Glog.java (98%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/IndexPack.java (76%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Log.java (100%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/LsRemote.java (85%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/LsTree.java (76%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Main.java (64%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/MergeBase.java (73%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Push.java (78%) copy {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/RevList.java (100%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/RevWalkTextBuiltin.java (62%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/ShowRef.java (97%) rename {org.spearce.jgit => org.spearce.jgit.pgm}/src/org/spearce/jgit/pgm/Tag.java (66%) create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/TextBuiltin.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/AbstractTreeIteratorHandler.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/CmdLineParser.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/ObjectIdHandler.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/PathTreeFilterHandler.java rename org.spearce.jgit/src/org/spearce/jgit/pgm/RevList.java => org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/RefSpecHandler.java (61%) create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/RevCommitHandler.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/RevTreeHandler.java create mode 100644 org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/SubcommandHandler.java delete mode 100644 org.spearce.jgit/src/org/spearce/jgit/pgm/TextBuiltin.java -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html