| com.atlassian.stash.repository.RepositoryService |
Describes a service for interacting with repositories.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Get the number of repositories that belong to a project.
| |||||||||||
Create a new repository.
| |||||||||||
Delete the repository.
| |||||||||||
Find all repositories in the system.
| |||||||||||
Retrieves a page of
repositories which have been forked from the specified origin. | |||||||||||
Retrieves a page of
repositories owned by the specified user. | |||||||||||
List the names of the repositories in the given project.
| |||||||||||
Retrieves the current user's personal fork of the specified
repository. | |||||||||||
Retrieves a page of
repositories which belong to the same hierarchy as the specified repository. | |||||||||||
Create a new repository by forking from an existing repository.
| |||||||||||
Retrieves a
Repository by its ID. | |||||||||||
Retrieves a
Repository by its slug. | |||||||||||
Retrieves
links that can be used to clone the supplied
repository via the repository's SCM's supported protocols. | |||||||||||
Calculates the size on disk for the specified repository and returns that size in bytes.
| |||||||||||
Retrieves a flag indicating whether the system has been configured to allow forking repositories.
| |||||||||||
If a create operation fails, calling this method will clean up the broken repository and try again.
| |||||||||||
Searches for
repositories that match the provided request. | |||||||||||
Update the metadata of a repository.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.atlassian.stash.repository.RepositorySupplier
| |||||||||||
Get the number of repositories that belong to a project.
| project | the project |
|---|
Create a new repository. The repository's slug will be derived from the name. Both
the name and the generated slug must be unique within the project.
creation
requested event is raised. This event is cancelable, allowing plugins to prevent repository creation based on
arbitrary considerations. If any listener cancels creation, the repository will not be created. It does
not require consensus among all registered listeners. If no listeners cancel, the repository will be created.
Events raised:
| request | describes the repository to create |
|---|
| RepositoryCreationCanceledException | if creation is canceled by an event listener |
|---|
Delete the repository. Both the on-disk repository and the database record are deleted. Any child and parent relationships are updated. The repository will be scheduled for deletion, which may happen after this call completes.
Before the repository is deleted, adeletion
requested event is raised. This event is cancelable, allowing plugins to prevent repository deletion based on
arbitrary considerations. If any listener cancels deletion, the repository will not be deleted. It does
not require consensus among all registered listeners. If no listeners cancel, the repository will be deleted.
Events raised:
| repository | the repository to be deleted. |
|---|
| RepositoryDeletionCanceledException | if deletion is canceled by an event listener |
|---|
Find all repositories in the system.
| pageRequest | the page of repositories to return. |
|---|
Retrieves a page of repositories which have been forked from the specified origin.
| origin | the origin repository for which forks should be found |
|---|---|
| pageRequest | the bounds of the page |
Retrieves a page of repositories owned by the specified user. These
are personal repositories, which may be personal forks of other repositories or
the user's own repositories.
| owner | the user to retrieve personal repositories for |
|---|---|
| pageRequest | the bounds of the page |
List the names of the repositories in the given project.
| projectKey | the project for which to list the repositories. |
|---|---|
| pageRequest | The page parameters for this query. |
null| NoSuchProjectException | if the specified project does not exist |
|---|
Retrieves the current user's personal fork of the specified repository. If the current
user has not yet forked the repository, or has forked it with a different name,
null will be returned.
| repository | the repository to retrieve the current user's personal fork for |
|---|
null if the current user
has not forked the repository or has forked it with a different nameRetrieves a page of repositories which belong to the same hierarchy as the specified repository. The specified repository will never itself be returned, even though it
is also part of the hierarchy.
| repository | the repository to retrieve related repositories for |
|---|---|
| pageRequest | the bounds of the page |
Create a new repository by forking from an existing repository. As with creating a repository from scratch, the fork's slug will be derived from its name,
and both the name and the slug must be unique within the target project.
project is provided, the fork will be created
in the forking user's personal project.name is provided, the
parent repository's name is retained for the fork.fork requested event
is raised. This event is cancelable, allowing plugins to prevent fork creation based on arbitrary considerations.
If any listener cancels forking, the fork will not be created. It does not require consensus among all
registered listeners. If no listeners cancel, the fork will be created.
Events raised:
| request | describes the repository to fork, as well as the project in which the fork should be created and the name that should be assigned to it |
|---|
| RepositoryForkCanceledException | if forking is canceled by an event listener |
|---|---|
| FeatureUnsupportedScmException | if the SCM for the parent repository does not support forking |
| ConstraintViolationException | if the fork's slug matches another repository within the user's personal project |
Retrieves a Repository by its ID.
| id | the repository's ID |
|---|
null if there is no repository with the specified ID or the current
user does not have access to itRetrieves a Repository by its slug. Slugs are only unique within a given
Project, so the project key is also required.
| projectKey | the key of the project to search in |
|---|---|
| slug | the slug of the repository to search for |
null if no repository matches the specified slug within the specified projectRetrieves links that can be used to clone the supplied
repository via the repository's SCM's supported protocols.
supplied user or the
currently authenticated user (if any). This might be
achieved, for instance, by inserting the user's name in the
URL's authority part although whether and how this customisation takes place is entirely up to each protocol.
Stash's own SSH and HTTP protocols do exactly this.
Each link has a name that indicates the protocol it supports
e.g. "ssh" or "http".| request | the request used to generate clone links |
|---|
Calculates the size on disk for the specified repository and returns that size in bytes.
If the providedRepository does not exist, its size is always 0.| repository | the repository whose size should be calculated |
|---|
Retrieves a flag indicating whether the system has been configured to allow forking repositories.
In addition to this system-wide setting, eachRepository may be explicitly configured as
isForkable() or not. If forking is disabled system-wide, even repositories
configured as forkable cannot be forked. By the same token, even if forking is enabled system-wide,
any repository which is explicitly configured to disallow forks cannot be forked.true if the system is configured to allow repository forking; otherwise, falseIf a create operation fails, calling this method will clean up the broken repository and try again.
The repository must be inINITIALISATION_FAILED
state in order to retry creation.| repository | the repository to retry |
|---|
| IllegalRepositoryStateException | if the repository is not in the required state |
|---|
Searches for repositories that match the provided request.
| request | a request object describing the repositories to return |
|---|---|
| pageRequest | the bounds of the page |
repositories that match the provided
criteriaUpdate the metadata of a repository. The possible updates are described in detail by the the
RepositoryUpdateRequest documentation.
slugs are derived from their names.
Updating a repository's name may change its slug, which will also change all browser and clone URLs for the
affected repository. Old URLs will no longer work after such an update.
Before the repository is updated, a modification requested event is raised. This event is cancelable, allowing plugins to prevent repository
modification based on arbitrary considerations. If any listener cancels modification, the repository
will not be updated. It does not require consensus among all registered listeners. If no listeners cancel,
the repository will be updated with the provided name.
Events raised:
| request | describes the repository to update and the updates to apply |
|---|
| RepositoryModificationCanceledException | if modification is canceled by an event listener |
|---|