public interface

RepositoryHookCommitCallback

com.atlassian.bitbucket.hook.repository.RepositoryHookCommitCallback
Known Indirect Subclasses

Class Overview

A callback to receive more information about commits added or removed in a RepositoryHookRequest. The callback will be called for each each relevant (ref, commit) pair:

Multiple callbacks can occur for the same commit. For instance, when branch A is merged into branch B and branch B is merged into branch C, a commit that was previously only on branch A will now be on branch A, B and C. In this case, 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 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.

Summary

Public Methods
boolean onCommitAdded(CommitAddedDetails commitDetails)
boolean onCommitRemoved(CommitRemovedDetails commitDetails)
void onEnd()
Callback method that is called after all commits have been offered to the callback.
void onStart()
Callback method that is called before the commits details are provided to onCommitAdded(CommitAddedDetails) and onCommitRemoved(CommitRemovedDetails)

Public Methods

public boolean onCommitAdded (CommitAddedDetails commitDetails)

Parameters
commitDetails the commit details
Returns
  • true 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.

public boolean onCommitRemoved (CommitRemovedDetails commitDetails)

Parameters
commitDetails the commit details
Returns
  • true 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.

public void onEnd ()

Callback method that is called after all commits have been offered to the callback. The callback can perform any cleanup operations here. If onStart() has been called, this method is guaranteed to be called when the callback has finished commit processing.

public void onStart ()

Callback method that is called before the commits details are provided to onCommitAdded(CommitAddedDetails) and onCommitRemoved(CommitRemovedDetails)