com.atlassian.bitbucket.scm.PluginExtendedCommandFactory |
Provides backing functionality for the ScmExtendedCommandFactory.
This interface is intended to be implemented by plugin developers. Functionality provided by this interface is intended to be consumed using the ScmExtendedCommandFactory exposed by the ScmService. Only the system should ever deal with this interface directly.
This interface describes optional commands which an SCM implementor may provide to extend the functionality of their SCM. Some features, like auto-merging between release branches and creating forks, rely on these optional commands. If the SCM does not implement them, the features which depend on them will be disabled.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Streams an archive of the repository at the specified commit, in the requested format.
| |||||||||||
Adds a new file or updates the content of an existing file as described in the
parameters . | |||||||||||
Creates a fork of
repository , stored in the specified fork . | |||||||||||
Streams the latest commit to modify each file in the specified LastModifiedCommandParameters#getPath()
path, using the provided LastModifiedCommandParameters#getCommitId() commit as the starting point
for the traversal.
| |||||||||||
Merges the specified
{@link MergeCommandParameters#getFromCommitId() fromCommitId into the specified
{@link MergeCommandParameters#getToBranch() toBranch . | |||||||||||
Retrieves requested objects and if the object is signed, provides the signature and signed content to the
callback.
| |||||||||||
Sets the default branch for the repository to the UpdateDefaultBranchCommandParameters#getBranchId()
named branch.
|
Streams an archive of the repository at the specified commit, in the requested format. If paths are supplied, the streamed archive should be filtered to only include files from the specified paths.
Implementors: This operation is optional. Implementations which do not support streaming archives should
return null
and omit the ScmFeature#ARCHIVE ARCHIVE feature. For simplicity, this factory
provides a default implementation which returns null
. SCMs which implement this command are
required to support streaming archives in all of the ArchiveFormat standard formats.
If the underlying SCM does not innately support one or more of the standard formats, the implementation is
required to augment the SCM and support them manually. If such augmentation is not possible, the SCM
must not implement this command.
repository | the repository to stream the archive from |
---|---|
parameters | parameters describing the commit to archive and the format to produce the archive in |
outputSupplier | a supplier which, when given the archive content type, will provide an output stream |
null
if archiving is not supportedAdds a new file or updates the content of an existing file as described in the parameters
.
Implementors: This feature is optional. Implementations which do not support updating the content of a file
should return null
and omit the ScmFeature#EDIT_FILE EDIT_FILE feature.
For simplicity, this factory provides a default implementation which returns null
.
repository | the repository in |
---|---|
parameters | parameters describing the file path, file content, branch and the previous contentId of the file. |
null
if editing file is not supportedCreates a fork of repository
, stored in the specified fork
.
Similar to creating
a repository, the specified fork must not
exist on disk when this command is called. It is expected that the SCM will create it with contents based
on repository
, which becomes the fork's origin
.
Implementors: This operation is optional. Implementations which do not support forking should return
null
and omit the ScmFeature#FORK FORK feature. For simplicity, this factory provides a
default implementation which returns null
.
repository | the fork repository |
---|---|
parameters | parameters describing the origin repository to be forked |
null
if forking is not supportedStreams the latest commit to modify each file in the specified LastModifiedCommandParameters#getPath() path, using the provided LastModifiedCommandParameters#getCommitId() commit as the starting point for the traversal.
Implementors: This feature is optional. Implementations which do not support updating the default branch
should return null
and omit the ScmFeature#LAST_MODIFIED LAST_MODIFIED feature. For simplicity,
this factory provides a default implementation which returns null
.
repository | the repository containing the starting commit |
---|---|
parameters | parameters describing the path to stream modifications for, and the starting commit for the traversal |
callback | a callback to receive the latest commit for files in the specified path |
null
if
streaming last modifications is not supportedMerges the specified {@link MergeCommandParameters#getFromCommitId() fromCommitId
into the specified
{@link MergeCommandParameters#getToBranch() toBranch
.
SCMs are required to support the following values for fromCommitId
:
toBranch
, as the parameter name suggests, must be a branch name, either fully qualified or short,
and the SCM should validate that that is the case; using a hash (full or short) is not supported.
Implementors: This feature is optional. Implementations which do not support merging should return
null
and omit the ScmFeature#MERGE MERGE feature. For simplicity, this factory provides a
default implementation which returns null
. Additionally, SCMs which support merging are not required to
support MergeCommandParameters#getFromRepository() different source repositories unless they offer
ScmFeature#CROSS_REPOSITORY cross-repository support. If a different from source repository is provided
and cross-repository operations are not supported, implementations
should throw an UnsupportedOperationException
.
repository | the repository containing both the source commit and the target branch |
---|---|
parameters | parameters describing the branches to merge |
null
if merging is not supportedUnsupportedOperationException | if a MergeCommandParameters#getFromRepository() source repository is specified and ScmFeature#CROSS_REPOSITORY cross-repository operations are not supported |
---|
Retrieves requested objects and if the object is signed, provides the signature and signed content to the callback.
repository | the repository containing the requested objects |
---|---|
parameters | describes which objects to retrieve |
callback | callback to receive the requested objects |
if the underlying SCM does not support retrieving signing objects |
Sets the default branch for the repository to the UpdateDefaultBranchCommandParameters#getBranchId() named branch.
Implementors: This feature is optional. Implementations which do not support updating the default branch
should return null
and omit the ScmFeature#UPDATE_DEFAULT_BRANCH UPDATE_DEFAULT_BRANCH feature.
For simplicity, this factory provides a default implementation which returns null
.
repository | the repository whose default branch should be updated |
---|---|
parameters | parameters describing the new branch to set as the default |
null
if updating the default branch is not supported