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:
parent
5e2e111280
commit
d1804d3f74
|
@ -71,6 +71,8 @@ public class CommitMsgHook extends GitHook<String> {
|
||||||
private String commitMessage;
|
private String commitMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor for CommitMsgHook
|
||||||
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
* The repository
|
* The repository
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
|
@ -81,6 +83,7 @@ protected CommitMsgHook(Repository repo, PrintStream outputStream) {
|
||||||
super(repo, outputStream);
|
super(repo, outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String call() throws IOException, AbortedByHookException {
|
public String call() throws IOException, AbortedByHookException {
|
||||||
if (commitMessage == null) {
|
if (commitMessage == null) {
|
||||||
|
@ -103,12 +106,15 @@ private boolean canRun() {
|
||||||
return getCommitEditMessageFilePath() != null && commitMessage != null;
|
return getCommitEditMessageFilePath() != null && commitMessage != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String getHookName() {
|
public String getHookName() {
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
* This hook receives one parameter, which is the path to the file holding
|
* This hook receives one parameter, which is the path to the file holding
|
||||||
* the current commit-msg, relative to the repository's work tree.
|
* the current commit-msg, relative to the repository's work tree.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -79,7 +79,10 @@ abstract class GitHook<T> implements Callable<T> {
|
||||||
protected final PrintStream outputStream;
|
protected final PrintStream outputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor for GitHook
|
||||||
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
|
* a {@link org.eclipse.jgit.lib.Repository} object.
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
* The output stream the hook must use. {@code null} is allowed,
|
* The output stream the hook must use. {@code null} is allowed,
|
||||||
* in which case the hook will use {@code System.out}.
|
* 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.
|
* 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
|
@Override
|
||||||
public abstract T call() throws IOException, AbortedByHookException;
|
public abstract T call() throws IOException, AbortedByHookException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get name of the hook
|
||||||
|
*
|
||||||
* @return The name of the hook, which must not be {@code null}.
|
* @return The name of the hook, which must not be {@code null}.
|
||||||
*/
|
*/
|
||||||
public abstract String getHookName();
|
public abstract String getHookName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the repository
|
||||||
|
*
|
||||||
* @return The repository.
|
* @return The repository.
|
||||||
*/
|
*/
|
||||||
protected Repository getRepository() {
|
protected Repository getRepository() {
|
||||||
|
@ -135,6 +138,8 @@ protected String getStdinArgs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get output stream
|
||||||
|
*
|
||||||
* @return The output stream the hook must use. Never {@code null},
|
* @return The output stream the hook must use. Never {@code null},
|
||||||
* {@code System.out} is returned by default.
|
* {@code System.out} is returned by default.
|
||||||
*/
|
*/
|
||||||
|
@ -145,7 +150,7 @@ protected PrintStream getOutputStream() {
|
||||||
/**
|
/**
|
||||||
* Runs the hook, without performing any validity checks.
|
* 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.
|
* If the underlying hook script exited with non-zero.
|
||||||
*/
|
*/
|
||||||
protected void doRun() throws AbortedByHookException {
|
protected void doRun() throws AbortedByHookException {
|
||||||
|
|
|
@ -54,7 +54,10 @@
|
||||||
public class Hooks {
|
public class Hooks {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create pre-commit hook for the given repository
|
||||||
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
|
* a {@link org.eclipse.jgit.lib.Repository} object.
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
* The output stream, or {@code null} to use {@code System.out}
|
* The output stream, or {@code null} to use {@code System.out}
|
||||||
* @return The pre-commit hook for the given repository.
|
* @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
|
* @param repo
|
||||||
|
* a {@link org.eclipse.jgit.lib.Repository} object.
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
* The output stream, or {@code null} to use {@code System.out}
|
* The output stream, or {@code null} to use {@code System.out}
|
||||||
* @return The post-commit hook for the given repository.
|
* @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
|
* @param repo
|
||||||
|
* a {@link org.eclipse.jgit.lib.Repository} object.
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
* The output stream, or {@code null} to use {@code System.out}
|
* The output stream, or {@code null} to use {@code System.out}
|
||||||
* @return The commit-msg hook for the given repository.
|
* @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
|
* @param repo
|
||||||
|
* a {@link org.eclipse.jgit.lib.Repository} object.
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
* The output stream, or {@code null} to use {@code System.out}
|
* The output stream, or {@code null} to use {@code System.out}
|
||||||
* @return The pre-push hook for the given repository.
|
* @return The pre-push hook for the given repository.
|
||||||
|
|
|
@ -60,6 +60,8 @@ public class PostCommitHook extends GitHook<Void> {
|
||||||
public static final String NAME = "post-commit"; //$NON-NLS-1$
|
public static final String NAME = "post-commit"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor for PostCommitHook
|
||||||
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
* The repository
|
* The repository
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
|
@ -70,12 +72,14 @@ protected PostCommitHook(Repository repo, PrintStream outputStream) {
|
||||||
super(repo, outputStream);
|
super(repo, outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws IOException, AbortedByHookException {
|
public Void call() throws IOException, AbortedByHookException {
|
||||||
doRun();
|
doRun();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String getHookName() {
|
public String getHookName() {
|
||||||
return NAME;
|
return NAME;
|
||||||
|
|
|
@ -60,6 +60,8 @@ public class PreCommitHook extends GitHook<Void> {
|
||||||
public static final String NAME = "pre-commit"; //$NON-NLS-1$
|
public static final String NAME = "pre-commit"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor for PreCommitHook
|
||||||
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
* The repository
|
* The repository
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
|
@ -70,12 +72,14 @@ protected PreCommitHook(Repository repo, PrintStream outputStream) {
|
||||||
super(repo, outputStream);
|
super(repo, outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws IOException, AbortedByHookException {
|
public Void call() throws IOException, AbortedByHookException {
|
||||||
doRun();
|
doRun();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String getHookName() {
|
public String getHookName() {
|
||||||
return NAME;
|
return NAME;
|
||||||
|
|
|
@ -72,6 +72,8 @@ public class PrePushHook extends GitHook<String> {
|
||||||
private String refs;
|
private String refs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor for PrePushHook
|
||||||
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
* The repository
|
* The repository
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
|
@ -82,11 +84,13 @@ protected PrePushHook(Repository repo, PrintStream outputStream) {
|
||||||
super(repo, outputStream);
|
super(repo, outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
protected String getStdinArgs() {
|
protected String getStdinArgs() {
|
||||||
return refs;
|
return refs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String call() throws IOException, AbortedByHookException {
|
public String call() throws IOException, AbortedByHookException {
|
||||||
if (canRun()) {
|
if (canRun()) {
|
||||||
|
@ -102,12 +106,15 @@ private boolean canRun() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String getHookName() {
|
public String getHookName() {
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* <p>
|
||||||
* This hook receives two parameters, which is the name and the location of
|
* This hook receives two parameters, which is the name and the location of
|
||||||
* the remote repository.
|
* the remote repository.
|
||||||
*/
|
*/
|
||||||
|
@ -120,21 +127,30 @@ protected String[] getParameters() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set remote name
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
|
* remote name
|
||||||
*/
|
*/
|
||||||
public void setRemoteName(String name) {
|
public void setRemoteName(String name) {
|
||||||
remoteName = name;
|
remoteName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set remote location
|
||||||
|
*
|
||||||
* @param location
|
* @param location
|
||||||
|
* a remote location
|
||||||
*/
|
*/
|
||||||
public void setRemoteLocation(String location) {
|
public void setRemoteLocation(String location) {
|
||||||
remoteLocation = location;
|
remoteLocation = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set Refs
|
||||||
|
*
|
||||||
* @param toRefs
|
* @param toRefs
|
||||||
|
* a collection of {@code RemoteRefUpdate}s
|
||||||
*/
|
*/
|
||||||
public void setRefs(Collection<RemoteRefUpdate> toRefs) {
|
public void setRefs(Collection<RemoteRefUpdate> toRefs) {
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
|
|
Loading…
Reference in New Issue