com.atlassian.bitbucket.scm.ScmService |
Describes a service for interacting with an SCM, allowing commands to be created/executed to perform SCM operations.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a
ScmCommandBuilder which can be used to construct free-form commands to interact directly with
the underlying SCM implementation and perform custom functions on repositories. | |||||||||||
Retrieves the set of
available SCMs . | |||||||||||
Retrieves an
ScmCommandFactory , used to create commands for performing standard SCM
operations such as retrieving commits and viewing diffs. | |||||||||||
Retrieves an
ScmCompareCommandFactory , used to create commands tailored for
comparing refs. | |||||||||||
Retrieves a
ScmHookHandlerFactory , used to create hook
handlers that manage scm hook callbacks. | |||||||||||
Retrieves an
ScmMirrorCommandFactory , used to create commands tailored for mirroring
repositories. | |||||||||||
Retrieves an
ScmPullRequestCommandFactory , used to create commands tailored for use
operating on pull requests. | |||||||||||
Retrieves the name for the
SCM which powers the specified repository. | |||||||||||
Calculates the size (in bytes) for the specified repository.
| |||||||||||
Tests whether the specified
Repository is empty. | |||||||||||
Tests whether the SCM for the specified
Repository supports the requested feature . | |||||||||||
Tests whether the specified SCM supports the requested
feature . |
Creates a ScmCommandBuilder
which can be used to construct free-form commands to interact directly with
the underlying SCM implementation and perform custom functions on repositories.
Command builders are provided as a very powerful extension point for plugin developers, allowing them to create new functionality that uses commands the application does not, or uses them in different ways. However, plugin developers should be aware that:
The created ScmCommandBuilder
will use the provided repository's
directory as its
initial working directory. After the builder has been created, it is possible to change the working directory
on the instance, before commands are constructed.
Note: Per the contract of the ScmCommandBuilder
API, the returned builder is not thread-safe. If
multiple threads require use of a builder, each thread should always create its own builder.
repository | the repository to create a builder for, used to determine the correct SCM implementation to use and to provide the initial working directory for built commands |
---|
FeatureUnsupportedScmException | if the target SCM does not support command builders |
---|---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Retrieves the set of available SCMs
. SCMs that are installed but not in a good state will
not be included in the returned set. The returned set will never be empty; the system requires at least one
available SCM or it will be locked out on startup.
Each SCM implementation is different, but examples of reasons why an installed SCM might not be available include:
git
or hg
, may not be installedRetrieves an ScmCommandFactory
, used to create commands
for performing standard SCM
operations such as retrieving commits and viewing diffs.
repository | the repository to retrieve a command factory for, used to determine the correct SCM implementation to use and to specify the repository created commands operate on |
---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
---|---|
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Retrieves an ScmCompareCommandFactory
, used to create commands
tailored for
comparing refs.
This differs from the normal getCommandFactory(Repository)
in that any comparison will be rooted
into the closest common ancestor between the refs. In other words, any comparison will be one sided
and only includes the changes the source ref
would bring to the
target ref
if they were merged.
compareRequest | the request describing the refs to compare |
---|
FeatureUnsupportedScmException | if the target SCM does not support comapring refs using their closest common ancestor |
---|---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Retrieves a ScmHookHandlerFactory
, used to create hook
handlers
that manage scm hook callbacks.
SCMs are not required to implement support for SCM hooks.
repository | the repository for which to retrieve the Scm |
---|
ScmHookHandlerFactory
used to create hook handlers
Retrieves an ScmMirrorCommandFactory
, used to create commands
tailored for mirroring
repositories.
SCMs are not required to implement support for mirroring.
repository | the repository to retrieve a command factory for, used to determine the correct SCM implementation to use |
---|
FeatureUnsupportedScmException | if the target SCM does not support mirroring |
---|---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Retrieves an ScmPullRequestCommandFactory
, used to create commands
tailored for use
operating on pull requests.
SCMs are not required to implement support for pull requests.
pullRequest | the pull request to retrieve a command factory for, used to determine the correct SCM implementation to use and to specify the pull request created commands operate on |
---|
FeatureUnsupportedScmException | if the target SCM does not support pull requests |
---|---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Retrieves an ScmRefCommandFactory
, used to create commands
tailored for creating
branches
and tags
.
SCMs are not required to implement support for creating branches or tags.
FeatureUnsupportedScmException | if the target SCM does not support mutable refs |
---|---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Retrieves the name for the SCM
which powers the specified repository.
repository | the repository to retrieve the SCM name for |
---|
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
---|---|
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Calculates the size (in bytes) for the specified repository. If the provided Repository
does not exist,
its size is always 0
.
Note: Calculating the size can be an expensive operation. The returned value may be a best effort estimation of the repository size.
repository | the repository whose size should be calculated |
---|
Tests whether the specified Repository
is empty.
repository | the repository to check |
---|
true
if the repository is empty; otherwise, false
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
---|---|
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Tests whether the SCM for the specified Repository
supports the requested feature
.
repository | the repository to check |
---|---|
feature | the feature to test |
true
if the SCM for the specified repository supports the requested feature
;
otherwise, false
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
---|---|
UnsupportedScmException | if the target SCM has been uninstalled or disabled |
Tests whether the specified SCM supports the requested feature
.
scmId | identifier of the SCM to check |
---|---|
feature | the feature to test |
true
if the SCM for the specified repository supports the requested feature
;
otherwise, false
UnavailableScmException | if the target SCM is installed and enabled but unavailable for some reason |
---|---|
UnsupportedScmException | if the target SCM has been uninstalled or disabled |