public interface ScmExtendedCommandFactory
commands
which provide optional SCM functionality such as merging two branches or updating
the default branch. Each method accepts a set of CommandParameters
which are used to control the command's
behaviour and output.
Each command on this factory has an associated SCM feature
. Prior to using any of these commands,
callers should check if the feature is supported
. Failure to
do so will result in FeatureUnsupportedScmException
s when requesting unsupported commands.
Modifier and Type | Method and Description |
---|---|
Command<Void> |
archive(ArchiveCommandParameters parameters,
TypeAwareOutputSupplier outputSupplier)
|
Command<Commit> |
editFile(EditFileCommandParameters parameters)
Adds a new file or updates the content of an existing file as described in the
parameters . |
Command<Void> |
lastModified(LastModifiedCommandParameters parameters,
LastModifiedCallback callback)
|
Command<Branch> |
merge(MergeCommandParameters parameters)
Merges the specified
fromCommitId into the specified toBranch . |
Command<Void> |
patch(PatchCommandParameters parameters,
TypeAwareOutputSupplier outputSupplier)
Streams a patch for a given
commit or commit range. |
Command<Void> |
push(PushCommandParameters parameters,
PushCallback callback)
Pushes the repository to the
URL specified in the parameters . |
Command<Void> |
signedObjects(SignedObjectsParameters parameters,
SignedObjectCallback callback)
Retrieves requested objects and if the object is signed, provides the signature and signed content to the
callback.
|
Command<Void> |
updateDefaultBranch(UpdateDefaultBranchCommandParameters parameters)
Sets the default branch for the repository to the specified branch.
|
@Nonnull Command<Void> archive(@Nonnull ArchiveCommandParameters parameters, @Nonnull TypeAwareOutputSupplier outputSupplier)
commit
in the requested
format
.
The provided commit ID may be:
branch ID
or display ID
commit ID
Display IDs
are not supported; there is no guarantee
a given display ID will be unique within the repositorytag ID
or display ID
This operation is optional and may not be supported by all SCM implementations. Calling this method on an
SCM which does not support it will result in a FeatureUnsupportedScmException
.
parameters
- parameters describing the commit to archive and the format to produce the archive inoutputSupplier
- a supplier which, when given the archive content type, will provide an output streamFeatureUnsupportedScmException
- if the underlying SCM does not support archiving repositoriesContentService.streamArchive(ArchiveRequest, TypeAwareOutputSupplier)
,
ScmFeature.ARCHIVE
@Nonnull Command<Commit> editFile(@Nonnull EditFileCommandParameters parameters)
parameters
.
This operation is optional and may not be supported by all SCM implementations. Calling this method on an
SCM which does not support it will result in a FeatureUnsupportedScmException
.
parameters
- parameters describing the file to be editedFeatureUnsupportedScmException
- if the underlying SCM does not support editing a file.ContentService.editFile(EditFileRequest)
,
ScmFeature.EDIT_FILE
@Nonnull Command<Void> lastModified(@Nonnull LastModifiedCommandParameters parameters, @Nonnull LastModifiedCallback callback)
path
, using the provided commit
as the starting point for the
traversal.
This operation is optional and may not be supported by all SCM implementations. Calling this method on an
SCM which does not support it will result in a FeatureUnsupportedScmException
.
parameters
- parameters describing the path to stream modifications for, and the starting commit for
the traversalcallback
- a callback to receive the latest commit for files in the specified pathFeatureUnsupportedScmException
- if the underlying SCM does not support streaming modificationsCommitService.streamLastModified(LastModifiedRequest, LastModifiedCallback)
,
ScmFeature.LAST_MODIFIED
@Nonnull Command<Branch> merge(@Nonnull MergeCommandParameters parameters)
fromCommitId
into the specified toBranch
.
The provided fromCommitId
may be:
toBranch
, as the parameter name suggests, must be a branch name, either fully
qualified or short; using a hash (full or short) is not supported.
If the SCM supports
cross-repository
merges, a different from repository
may
be provided. Otherwise, it must be omitted or match the target repository.
This operation is optional and may not be supported by all SCM implementations. Calling this method on an
SCM which does not support it will result in a FeatureUnsupportedScmException
.
Note: This method is not exposed via the service API. It is only available directly on the SCM API.
parameters
- parameters describing the branches to mergeFeatureUnsupportedScmException
- if the underlying SCM does not support merging branches, or if a
cross-repository merge was requested and the SCM doesn't support
cross-repository
mergesScmFeature.MERGE
@Nonnull Command<Void> patch(@Nonnull PatchCommandParameters parameters, @Nonnull TypeAwareOutputSupplier outputSupplier)
commit
or commit range.
If PatchCommandParameters.isAllAncestors()
is true then the patch includes all ancestors of the
"until"
revision. Otherwise the patch starts from the
"since"
revision, if specified, or from the parent of the
"until"
revision.
This operation is optional and may not be supported by all SCM implementations. Calling this method on an SCM
which does not support it will result in a FeatureUnsupportedScmException
.
parameters
- parameters describing the commit for which to generate the patchoutputSupplier
- a supplier which will provide an output streamFeatureUnsupportedScmException
- if the underlying SCM does not support patches for repositoriesContentService.streamPatch(PatchRequest, TypeAwareOutputSupplier)
,
ScmFeature.PATCH
@Nonnull Command<Void> push(@Nonnull PushCommandParameters parameters, @Nonnull PushCallback callback)
URL specified in the parameters
.parameters
- parameters describing the target of the push, optional authentication and which refs should
be includedcallback
- a callback that will receive ref updates, ref failures and progress updatesFeatureUnsupportedScmException
- if the underlying SCM does not support pushingScmFeature.PUSH
@Nonnull Command<Void> signedObjects(@Nonnull SignedObjectsParameters parameters, @Nonnull SignedObjectCallback callback)
parameters
- describes which objects to retrievecallback
- callback to receive the requested objectsFeatureUnsupportedScmException
- if the underlying SCM does not support retrieving signed objectsScmFeature.SIGNED_OBJECTS
@Nonnull Command<Void> updateDefaultBranch(@Nonnull UpdateDefaultBranchCommandParameters parameters)
This operation is optional and may not be supported by all SCM implementations. Calling this method on an
SCM which does not support it will result in a FeatureUnsupportedScmException
.
parameters
- parameters describing the branch to make the defaultFeatureUnsupportedScmException
- if the underlying SCM does not support setting the default branchRefService.setDefaultBranch(Repository, String)
,
ScmFeature.UPDATE_DEFAULT_BRANCH
Copyright © 2022 Atlassian. All rights reserved.