Class RepositoryForkRequestedEvent
- All Implemented Interfaces:
CancelableEvent
,CancelState
,Serializable
repository
is forked. This event is synchronous, allowing listeners to
perform operations in the same database transaction where the forked repository will be created.
The repository
attached to the event is the fork to be created. Its
origin
provides the repository that will be forked to create it. Note that forks can
be created in the same project as their origin or in different one, so the project
s
for the fork and its origin may or may not be the same.
This event is cancelable
. A listener may prevent the repository from being forked by
canceling
this event. Throwing an exception will not prevent the repository
from being forked; the exception will be logged and ignored.
Note: The repository attached to the event will not have an ID
, as it has not
been created yet, but it will have its origin repository
available. Any
listener which would like to create associations based on the repository ID must listen for the
RepositoryForkedEvent
instead, which will include it (but will not run in the same transaction).
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionRepositoryForkRequestedEvent
(Object source, Repository repository, String defaultBranch, CancelState cancelState) -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the default branch the fork will use, if one was specified.Methods inherited from class com.atlassian.bitbucket.event.repository.RepositoryCreationRequestedEvent
cancel, isCanceled
Methods inherited from class com.atlassian.bitbucket.event.repository.RepositoryEvent
getRepository
Methods inherited from class com.atlassian.bitbucket.event.ApplicationEvent
getDate, getUser
Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
RepositoryForkRequestedEvent
public RepositoryForkRequestedEvent(@Nonnull Object source, @Nonnull Repository repository, @Nullable String defaultBranch, @Nonnull CancelState cancelState) - Parameters:
source
- the source of the eventrepository
- the fork to be createddefaultBranch
- the default branch for the fork, ornull
if the origin's default will be inheritedcancelState
- tracks vetoes for the event- Since:
- 7.5
-
-
Method Details
-
getDefaultBranch
Retrieves the default branch the fork will use, if one was specified. If no default was specified theorigin's
default branch will be inherited. This differs from creating a new repository, where the SCM's default branch is used if one isn't specified.- Overrides:
getDefaultBranch
in classRepositoryCreationRequestedEvent
- Returns:
- the default branch, or
null
if the origin's default branch will be inherited - Since:
- 7.5
-