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.
- Since:
- 4.6
-
Method Summary
Modifier and TypeMethodDescriptionarchive
(ArchiveCommandParameters parameters, TypeAwareOutputSupplier outputSupplier) editFile
(EditFileCommandParameters parameters) Adds a new file or updates the content of an existing file as described in theparameters
.lastModified
(LastModifiedCommandParameters parameters, LastModifiedCallback callback) merge
(MergeCommandParameters parameters) Merges the specifiedfromCommitId
into the specifiedtoBranch
.patch
(PatchCommandParameters parameters, TypeAwareOutputSupplier outputSupplier) Streams a patch for a givencommit
or commit range.push
(PushCommandParameters parameters, PushCallback callback) Pushes the repository to theURL specified in the parameters
.revert
(RevertCommandParameters parameters) Reverts the specified commit on a given branch as described by theparameters
.signedObjects
(SignedObjectsParameters parameters, SignedObjectCallback callback) 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 specified branch.
-
Method Details
-
archive
@Nonnull Command<Void> archive(@Nonnull ArchiveCommandParameters parameters, @Nonnull TypeAwareOutputSupplier outputSupplier) Streams an archive of the specifiedcommit
in the requestedformat
.The provided commit ID may be:
- A
branch ID
ordisplay ID
- A
commit ID
Display IDs
are not supported; there is no guarantee a given display ID will be unique within the repository
- A
tag ID
ordisplay 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
- 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 stream- Returns:
- a command which, when executed, will stream an archive of the repository at the specified commit
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support archiving repositories- Since:
- 5.1
- See Also:
- A
-
editFile
Adds a new file or updates the content of an existing file as described in theparameters
.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
- parameters describing the file to be edited- Returns:
- a command which, when executed, will edit the content of a file
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support editing a file.- Since:
- 4.13
- See Also:
-
lastModified
@Nonnull Command<Void> lastModified(@Nonnull LastModifiedCommandParameters parameters, @Nonnull LastModifiedCallback callback) Streams the latest commit to modify each file in the specifiedpath
, using the providedcommit
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
- 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 path- Returns:
- a command which, when executed, will stream the latest commit to modify each file in the specified path
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support streaming modifications- See Also:
-
merge
Merges the specifiedfromCommitId
into the specifiedtoBranch
.The provided
fromCommitId
may be:- A 40-byte hash (Note: Short hashes are not supported)
- A fully-qualified branch name
- A short branch name
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 differentfrom 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
- parameters describing the branches to merge- Returns:
- a command which, when executed, will merge the specified commit into the target branch
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support merging branches, or if a cross-repository merge was requested and the SCM doesn't supportcross-repository
merges- See Also:
-
patch
@Nonnull Command<Void> patch(@Nonnull PatchCommandParameters parameters, @Nonnull TypeAwareOutputSupplier outputSupplier) Streams a patch for a givencommit
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
- parameters describing the commit for which to generate the patchoutputSupplier
- a supplier which will provide an output stream- Returns:
- a command which, when executed, will stream a patch of the diff at the specified commit
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support patches for repositories- Since:
- 6.7
- See Also:
-
push
@Nonnull Command<Void> push(@Nonnull PushCommandParameters parameters, @Nonnull PushCallback callback) Pushes the repository to theURL specified in the parameters
.- 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 updates- Returns:
- a command which, when executed, will perform a push of the repository to the URL specified
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support pushing- Since:
- 7.11
- See Also:
-
revert
Reverts the specified commit on a given branch as described by theparameters
.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
- parameters describing the commit to be reverted- Returns:
- a command which when executed reverts the commit and returns the
Branch branch
which contains the revert commit - Since:
- 8.13
- See Also:
-
signedObjects
@Nonnull Command<Void> signedObjects(@Nonnull SignedObjectsParameters parameters, @Nonnull SignedObjectCallback callback) Retrieves requested objects and if the object is signed, provides the signature and signed content to the callback.- Parameters:
parameters
- describes which objects to retrievecallback
- callback to receive the requested objects- Returns:
- a command which, when executed, will retrieve the requested objects and provides them to the provided callback
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support retrieving signed objects- Since:
- 5.1
- See Also:
-
updateDefaultBranch
@Nonnull Command<Void> updateDefaultBranch(@Nonnull UpdateDefaultBranchCommandParameters parameters) Sets the default branch for the repository to the specified branch.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
- parameters describing the branch to make the default- Returns:
- a command which, when executed, will update the repository's default branch
- Throws:
FeatureUnsupportedScmException
- if the underlying SCM does not support setting the default branch- See Also:
-