public class PrePushHook extends GitHook<java.lang.String>
pre-push
hook implementation. The pre-push hook runs during
git push, after the remote refs have been updated but before any objects have
been transferred.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
Constant indicating the name of the pre-push hook.
|
private java.lang.String |
refs |
private java.lang.String |
remoteLocation |
private java.lang.String |
remoteName |
errorStream, outputStream
Modifier | Constructor and Description |
---|---|
protected |
PrePushHook(Repository repo,
java.io.PrintStream outputStream)
Constructor for PrePushHook
|
protected |
PrePushHook(Repository repo,
java.io.PrintStream outputStream,
java.io.PrintStream errorStream)
Constructor for PrePushHook
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
call() |
private boolean |
canRun() |
java.lang.String |
getHookName()
Get name of the hook
|
protected java.lang.String[] |
getParameters()
Override this method when needed to provide relevant parameters to the
underlying hook script.
|
protected java.lang.String |
getRemoteName()
Get remote name
|
protected java.lang.String |
getStdinArgs()
Override to provide relevant arguments via stdin to the underlying hook
script.
|
void |
setRefs(java.util.Collection<RemoteRefUpdate> toRefs)
Set Refs
|
void |
setRemoteLocation(java.lang.String location)
Set remote location
|
void |
setRemoteName(java.lang.String name)
Set remote name
|
doRun, getErrorStream, getOutputStream, getRepository, isNativeHookPresent
public static final java.lang.String NAME
private java.lang.String remoteName
private java.lang.String remoteLocation
private java.lang.String refs
protected PrePushHook(Repository repo, java.io.PrintStream outputStream)
This constructor will use the default error stream.
repo
- The repositoryoutputStream
- The output stream the hook must use. null
is allowed,
in which case the hook will use System.out
.protected PrePushHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)
repo
- The repositoryoutputStream
- The output stream the hook must use. null
is allowed,
in which case the hook will use System.out
.errorStream
- The error stream the hook must use. null
is allowed,
in which case the hook will use System.err
.protected java.lang.String getStdinArgs()
null
.getStdinArgs
in class GitHook<java.lang.String>
public java.lang.String call() throws java.io.IOException, AbortedByHookException
Run the hook.
call
in interface java.util.concurrent.Callable<java.lang.String>
call
in class GitHook<java.lang.String>
java.io.IOException
AbortedByHookException
private boolean canRun()
true
public java.lang.String getHookName()
getHookName
in class GitHook<java.lang.String>
null
.protected java.lang.String[] getParameters()
This hook receives two parameters, which is the name and the location of the remote repository.
getParameters
in class GitHook<java.lang.String>
public void setRemoteName(java.lang.String name)
name
- remote nameprotected java.lang.String getRemoteName()
public void setRemoteLocation(java.lang.String location)
location
- a remote locationpublic void setRefs(java.util.Collection<RemoteRefUpdate> toRefs)
toRefs
- a collection of RemoteRefUpdate
s