Commands are configured with a single "current" repository and then the
execute(String[]) method is invoked with the arguments that appear
on the command line after the command name.
Command constructors should perform as little work as possible as they may be invoked very early during process loading, and the command may not execute even though it was constructed.
| Modifier and Type | Class and Description |
|---|---|
| public static class | TextBuiltin.
Exception thrown by |
| Modifier and Type | Field and Description |
|---|---|
| protected RevWalk | argWalk
RevWalk used during command line parsing, if it was required. |
| private String | |
| protected Repository | db
Git repository the command was invoked within. |
| protected OutputStream | errs
Error output stream, typically this is standard error. |
| protected ThrowingPrintWriter | errw
Error writer, typically this is standard error. |
| protected String | gitdir
Directory supplied via --git-dir command line option. |
| private boolean | |
| protected InputStream | ins
Input stream, typically this is standard input. |
| protected OutputStream | outs
Stream to output to, typically this is standard output. |
| protected ThrowingPrintWriter | outw
Writer to output to, typically this is standard output. |
| private SshDriver |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| public static boolean | Returns: true if the given array contains help optionnon null args)Check if the arguments contain a help option |
| protected static Die | |
| protected static Die | |
| protected static Die | Returns: a runtime exception the caller is expected to throwboolean indicating that the execution has been aborted before
running aborted)Exit the command |
| protected static Die | |
| public final void | |
| public ThrowingPrintWriter | |
| private Charset | Returns: Charset corresponding toi18n.logOutputEncoding, or
UTF_8.the repository. repository)Get the log output encoding specified in the repository's
|
| public ThrowingPrintWriter | |
| public Repository | |
| protected ResourceBundle | Returns: the resource bundle that will be passed to args4j for purpose of string localizationGet resource bundle with localized texts |
| protected void | init(Repository
the opened repository that the command should work on. repository, String value of the gitDir)--git-dir command line option, if
repository is null.Initialize the command to work with a repository. |
| public void | initRaw(final Repository
the opened repository that the command should work on. repository, final String value of the gitDir, InputStream --git-dir command line option, if
repository is null.input stream from which input will be read input, OutputStream output stream to which output will be written output, OutputStream error stream to which errors will be written error)Initializes the command to work with a repository, including setting the output and error streams. |
| protected void | parseArguments(String[]
the arguments supplied on the command line, if any. args)Parses the command line arguments prior to running. |
| protected void | printUsage(String
non null message, CmdLineParser parser used to print options clp)Print usage help text. |
| public void | printUsageAndExit(CmdLineParser
a clp)org. object.Print the usage line |
| public void | printUsageAndExit(String
a message, CmdLineParser java. object.a clp)org. object.Print an error message and the usage line |
| protected boolean | |
| pack-priv ObjectId | |
| protected abstract void | |
| pack-priv final void |
| argWalk | back to summary |
|---|---|
| protected RevWalk argWalk RevWalk used during command line parsing, if it was required. | |
| commandName | back to summary |
|---|---|
| private String commandName | |
| db | back to summary |
|---|---|
| protected Repository db Git repository the command was invoked within. | |
| errs | back to summary |
|---|---|
| protected OutputStream errs Error output stream, typically this is standard error.
| |
| errw | back to summary |
|---|---|
| protected ThrowingPrintWriter errw Error writer, typically this is standard error.
| |
| gitdir | back to summary |
|---|---|
| protected String gitdir Directory supplied via --git-dir command line option. | |
| help | back to summary |
|---|---|
private boolean help
| |
| ins | back to summary |
|---|---|
| protected InputStream ins Input stream, typically this is standard input.
| |
| outs | back to summary |
|---|---|
| protected OutputStream outs Stream to output to, typically this is standard output.
| |
| outw | back to summary |
|---|---|
| protected ThrowingPrintWriter outw Writer to output to, typically this is standard output.
| |
| sshDriver | back to summary |
|---|---|
private SshDriver sshDriver
| |
| TextBuiltin | back to summary |
|---|---|
| public TextBuiltin() | |
| abbreviateRef | back to summary |
|---|---|
| pack-priv String abbreviateRef(String dst, boolean abbreviateRemote) | |
| containsHelp | back to summary |
|---|---|
| public static boolean containsHelp(String[] args) Check if the arguments contain a help option
| |
| die | back to summary |
|---|---|
| protected static Die die(String why) Exit the command with an error message | |
| die | back to summary |
|---|---|
| protected static Die die(String why, Throwable cause) Exit the command with an error message and an exception | |
| die | back to summary |
|---|---|
| protected static Die die(boolean aborted) Exit the command
| |
| die | back to summary |
|---|---|
| protected static Die die(boolean aborted, Throwable cause) Exit the command | |
| execute | back to summary |
|---|---|
| public final void execute(String[] args) throws Exception Parse arguments and run this command. | |
| getErrorWriter | back to summary |
|---|---|
| public ThrowingPrintWriter getErrorWriter() Get error writer
| |
| getLogOutputEncodingCharset | back to summary |
|---|---|
| private Charset getLogOutputEncodingCharset(Repository repository) Get the log output encoding specified in the repository's
| |
| getOutputWriter | back to summary |
|---|---|
| public ThrowingPrintWriter getOutputWriter() Get output writer
| |
| getRepository | back to summary |
|---|---|
| public Repository getRepository() Get the repository
| |
| getResourceBundle | back to summary |
|---|---|
| protected ResourceBundle getResourceBundle() Get resource bundle with localized texts
| |
| init | back to summary |
|---|---|
| protected void init(Repository repository, String gitDir) Initialize the command to work with a repository.
| |
| initRaw | back to summary |
|---|---|
| public void initRaw(final Repository repository, final String gitDir, InputStream input, OutputStream output, OutputStream error) Initializes the command to work with a repository, including setting the output and error streams.
| |
| parseArguments | back to summary |
|---|---|
| protected void parseArguments(String[] args) throws IOException Parses the command line arguments prior to running.
This method should only be invoked by
| |
| printUsage | back to summary |
|---|---|
| protected void printUsage(String message, CmdLineParser clp) throws IOException Print usage help text.
| |
| printUsageAndExit | back to summary |
|---|---|
| public void printUsageAndExit(CmdLineParser clp) throws IOException Print the usage line
| |
| printUsageAndExit | back to summary |
|---|---|
| public void printUsageAndExit(String message, CmdLineParser clp) throws IOException Print an error message and the usage line
| |
| requiresRepository | back to summary |
|---|---|
| protected boolean requiresRepository() If this command requires a repository.
| |
| resolve | back to summary |
|---|---|
| pack-priv ObjectId resolve(String s) throws IOException | |
| run | back to summary |
|---|---|
| protected abstract void run() throws Exception Perform the actions of this command.
This method should only be invoked by
| |
| setCommandName | back to summary |
|---|---|
| pack-priv final void setCommandName(String name) | |
TextBuiltin if it proceeds 'help' option
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| TerminatedByHelpException | back to summary |
|---|---|
| public TerminatedByHelpException() Default constructor | |