Modifier and Type | Field and Description |
---|---|
static String |
NAME
Constant indicating the name of the pre-push hook.
|
protected PrintStream |
outputStream
The output stream to be used by the hook.
|
Modifier | Constructor and Description |
---|---|
protected |
PrePushHook(Repository repo,
PrintStream outputStream)
Constructor for PrePushHook
|
Modifier and Type | Method and Description |
---|---|
String |
call() |
protected void |
doRun()
Runs the hook, without performing any validity checks.
|
String |
getHookName()
Get name of the hook
|
protected PrintStream |
getOutputStream()
Get output stream
|
protected String[] |
getParameters()
Override this method when needed to provide relevant parameters to the
underlying hook script.
|
protected String |
getRemoteName()
Get remote name
|
protected Repository |
getRepository()
Get the repository
|
protected String |
getStdinArgs()
Override to provide relevant arguments via stdin to the underlying hook
script.
|
boolean |
isNativeHookPresent()
Check whether a 'native' (i.e.
|
void |
setRefs(Collection<RemoteRefUpdate> toRefs)
Set Refs
|
void |
setRemoteLocation(String location)
Set remote location
|
void |
setRemoteName(String name)
Set remote name
|
public static final String NAME
protected final PrintStream outputStream
protected PrePushHook(Repository repo, PrintStream outputStream)
repo
- The repositoryoutputStream
- The output stream the hook must use. null
is allowed,
in which case the hook will use System.out
.protected String getStdinArgs()
null
.public String call() throws IOException, AbortedByHookException
Run the hook.
call
in interface Callable<String>
IOException
AbortedByHookException
public String getHookName()
null
.protected String[] getParameters()
This hook receives two parameters, which is the name and the location of the remote repository.
public void setRemoteName(String name)
name
- remote nameprotected String getRemoteName()
public void setRemoteLocation(String location)
location
- a remote locationpublic void setRefs(Collection<RemoteRefUpdate> toRefs)
toRefs
- a collection of RemoteRefUpdate
sprotected Repository getRepository()
protected PrintStream getOutputStream()
null
,
System.out
is returned by default.protected void doRun() throws AbortedByHookException
AbortedByHookException
- If the underlying hook script exited with non-zero.public boolean isNativeHookPresent()
Copyright © 2019 Eclipse JGit Project. All rights reserved.