Interface RepositoryHookCommitCallback
- All Known Subinterfaces:
PreRepositoryHookCommitCallback
RepositoryHookRequest
.
The callback will be called for each each relevant (ref, commit) pair:
- For
added
refs, only new commits are provided toonCommitAdded(CommitAddedDetails)
. For new refs that point to existing commits, no commits are provided to the callback. - For
deleted
refs, only commits that are removed from the repository (orphaned) are providedonCommitRemoved(CommitRemovedDetails)
. - For
updated
refs, all commits that are added or removed to that ref are provided to the callback.
onCommitAdded(CommitAddedDetails)
is called for both branch B and C.
The system will call onStart()
before the first commit details are provided to the callback to allow the
hook to initialize. Likewise, the system calls onEnd()
after the last commit details have been provided
to the callback. This can be because all commit details have been provided, the callback has returned false
from one of the callback methods to instruct the system that it's done processing commits, or - in the case of
pre-hooks
- because the request has been vetoed and no further commit processing will be
done.
If a RepositoryHookRequest
is vetoed in
PreRepositoryHook.preUpdate(PreRepositoryHookContext, RepositoryHookRequest)
before commit details are
retrieved, callbacks will not be called at all; the onStart()
and onEnd()
methods will not be
called. However, if the onStart()
method is called, the system will also call the onEnd()
method
at the end of processing.
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
onCommitAdded
(CommitAddedDetails commitDetails) default boolean
onCommitRemoved
(CommitRemovedDetails commitDetails) default void
onEnd()
Callback method that is called after all commits have been offered to the callback.default void
onStart()
Callback method that is called before the commits details are provided toonCommitAdded(CommitAddedDetails)
andonCommitRemoved(CommitRemovedDetails)
-
Method Details
-
onCommitAdded
- Parameters:
commitDetails
- the commit details- Returns:
true
if the callback wants to receive details about added and removed commits. Otherwisefalse
. When this method returnsfalse
, neither this method noronCommitRemoved(CommitRemovedDetails)
will be called with further commit details.
-
onCommitRemoved
- Parameters:
commitDetails
- the commit details- Returns:
true
if the callback wants to receive details about added and removed commits. Otherwisefalse
. When this method returnsfalse
, neither this method noronCommitAdded(CommitAddedDetails)
will be called with further commit details.
-
onEnd
default void onEnd()Callback method that is called after all commits have been offered to the callback. The callback can perform any cleanup operations here. IfonStart()
has been called, this method is guaranteed to be called when the callback has finished commit processing. -
onStart
default void onStart()Callback method that is called before the commits details are provided toonCommitAdded(CommitAddedDetails)
andonCommitRemoved(CommitRemovedDetails)
-