public interface RepositoryHookCommitCallback
RepositoryHookRequest
.
The callback will be called for each each relevant (ref, commit) pair:
added
refs, only new commits are
provided to onCommitAdded(CommitAddedDetails)
. For new refs that point
to existing commits, no commits are provided to the callback.
deleted
refs, only commits that are
removed from the repository (orphaned) are provided
onCommitRemoved(CommitRemovedDetails)
.
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.
Modifier and Type | Method and Description |
---|---|
default 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 to
onCommitAdded(CommitAddedDetails) and onCommitRemoved(CommitRemovedDetails) |
default boolean onCommitAdded(@Nonnull CommitAddedDetails commitDetails)
commitDetails
- the commit detailstrue
if the callback wants to receive details about added and removed commits.
Otherwise false
. When this method returns false
, neither this method nor
onCommitRemoved(CommitRemovedDetails)
will be called with further commit details.default boolean onCommitRemoved(@Nonnull CommitRemovedDetails commitDetails)
commitDetails
- the commit detailstrue
if the callback wants to receive details about added and removed commits.
Otherwise false
. When this method returns false
, neither this method nor
onCommitAdded(CommitAddedDetails)
will be called with further commit details.default void onEnd()
onStart()
has been called, this method is guaranteed to be called
when the callback has finished commit processing.default void onStart()
onCommitAdded(CommitAddedDetails)
and onCommitRemoved(CommitRemovedDetails)
Copyright © 2024 Atlassian. All rights reserved.