Fix javadoc in org.eclipse.jgit hooks package

Change-Id: I3b644048eb0fc19f94ba8f9799b5a2310481103f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2017-12-18 11:55:56 +01:00
parent 5e2e111280
commit d1804d3f74
6 changed files with 54 additions and 7 deletions

View File

@ -71,6 +71,8 @@ public class CommitMsgHook extends GitHook<String> {
private String commitMessage;
/**
* Constructor for CommitMsgHook
*
* @param repo
* The repository
* @param outputStream
@ -81,6 +83,7 @@ protected CommitMsgHook(Repository repo, PrintStream outputStream) {
super(repo, outputStream);
}
/** {@inheritDoc} */
@Override
public String call() throws IOException, AbortedByHookException {
if (commitMessage == null) {
@ -103,12 +106,15 @@ private boolean canRun() {
return getCommitEditMessageFilePath() != null && commitMessage != null;
}
/** {@inheritDoc} */
@Override
public String getHookName() {
return NAME;
}
/**
* {@inheritDoc}
*
* This hook receives one parameter, which is the path to the file holding
* the current commit-msg, relative to the repository's work tree.
*/

View File

@ -79,7 +79,10 @@ abstract class GitHook<T> implements Callable<T> {
protected final PrintStream outputStream;
/**
* Constructor for GitHook
*
* @param repo
* a {@link org.eclipse.jgit.lib.Repository} object.
* @param outputStream
* The output stream the hook must use. {@code null} is allowed,
* in which case the hook will use {@code System.out}.
@ -90,23 +93,23 @@ protected GitHook(Repository repo, PrintStream outputStream) {
}
/**
* {@inheritDoc}
* <p>
* Run the hook.
*
* @throws IOException
* if IO goes wrong.
* @throws AbortedByHookException
* If the hook has been run and a returned an exit code
* different from zero.
*/
@Override
public abstract T call() throws IOException, AbortedByHookException;
/**
* Get name of the hook
*
* @return The name of the hook, which must not be {@code null}.
*/
public abstract String getHookName();
/**
* Get the repository
*
* @return The repository.
*/
protected Repository getRepository() {
@ -135,6 +138,8 @@ protected String getStdinArgs() {
}
/**
* Get output stream
*
* @return The output stream the hook must use. Never {@code null},
* {@code System.out} is returned by default.
*/
@ -145,7 +150,7 @@ protected PrintStream getOutputStream() {
/**
* Runs the hook, without performing any validity checks.
*
* @throws AbortedByHookException
* @throws org.eclipse.jgit.api.errors.AbortedByHookException
* If the underlying hook script exited with non-zero.
*/
protected void doRun() throws AbortedByHookException {

View File

@ -54,7 +54,10 @@
public class Hooks {
/**
* Create pre-commit hook for the given repository
*
* @param repo
* a {@link org.eclipse.jgit.lib.Repository} object.
* @param outputStream
* The output stream, or {@code null} to use {@code System.out}
* @return The pre-commit hook for the given repository.
@ -65,7 +68,10 @@ public static PreCommitHook preCommit(Repository repo,
}
/**
* Create post-commit hook for the given repository
*
* @param repo
* a {@link org.eclipse.jgit.lib.Repository} object.
* @param outputStream
* The output stream, or {@code null} to use {@code System.out}
* @return The post-commit hook for the given repository.
@ -77,7 +83,10 @@ public static PostCommitHook postCommit(Repository repo,
}
/**
* Create commit-msg hook for the given repository
*
* @param repo
* a {@link org.eclipse.jgit.lib.Repository} object.
* @param outputStream
* The output stream, or {@code null} to use {@code System.out}
* @return The commit-msg hook for the given repository.
@ -88,7 +97,10 @@ public static CommitMsgHook commitMsg(Repository repo,
}
/**
* Create pre-push hook for the given repository
*
* @param repo
* a {@link org.eclipse.jgit.lib.Repository} object.
* @param outputStream
* The output stream, or {@code null} to use {@code System.out}
* @return The pre-push hook for the given repository.

View File

@ -60,6 +60,8 @@ public class PostCommitHook extends GitHook<Void> {
public static final String NAME = "post-commit"; //$NON-NLS-1$
/**
* Constructor for PostCommitHook
*
* @param repo
* The repository
* @param outputStream
@ -70,12 +72,14 @@ protected PostCommitHook(Repository repo, PrintStream outputStream) {
super(repo, outputStream);
}
/** {@inheritDoc} */
@Override
public Void call() throws IOException, AbortedByHookException {
doRun();
return null;
}
/** {@inheritDoc} */
@Override
public String getHookName() {
return NAME;

View File

@ -60,6 +60,8 @@ public class PreCommitHook extends GitHook<Void> {
public static final String NAME = "pre-commit"; //$NON-NLS-1$
/**
* Constructor for PreCommitHook
*
* @param repo
* The repository
* @param outputStream
@ -70,12 +72,14 @@ protected PreCommitHook(Repository repo, PrintStream outputStream) {
super(repo, outputStream);
}
/** {@inheritDoc} */
@Override
public Void call() throws IOException, AbortedByHookException {
doRun();
return null;
}
/** {@inheritDoc} */
@Override
public String getHookName() {
return NAME;

View File

@ -72,6 +72,8 @@ public class PrePushHook extends GitHook<String> {
private String refs;
/**
* Constructor for PrePushHook
*
* @param repo
* The repository
* @param outputStream
@ -82,11 +84,13 @@ protected PrePushHook(Repository repo, PrintStream outputStream) {
super(repo, outputStream);
}
/** {@inheritDoc} */
@Override
protected String getStdinArgs() {
return refs;
}
/** {@inheritDoc} */
@Override
public String call() throws IOException, AbortedByHookException {
if (canRun()) {
@ -102,12 +106,15 @@ private boolean canRun() {
return true;
}
/** {@inheritDoc} */
@Override
public String getHookName() {
return NAME;
}
/**
* {@inheritDoc}
* <p>
* This hook receives two parameters, which is the name and the location of
* the remote repository.
*/
@ -120,21 +127,30 @@ protected String[] getParameters() {
}
/**
* Set remote name
*
* @param name
* remote name
*/
public void setRemoteName(String name) {
remoteName = name;
}
/**
* Set remote location
*
* @param location
* a remote location
*/
public void setRemoteLocation(String location) {
remoteLocation = location;
}
/**
* Set Refs
*
* @param toRefs
* a collection of {@code RemoteRefUpdate}s
*/
public void setRefs(Collection<RemoteRefUpdate> toRefs) {
StringBuilder b = new StringBuilder();