Package sonia.scm.repository.api
Class RepositoryService
java.lang.Object
sonia.scm.repository.api.RepositoryService
- All Implemented Interfaces:
Closeable
,AutoCloseable
From the
Note: Not every
Warning: You should always close the connection to the repository after work is finished. For closing the connection to the repository use the
RepositoryService
it is possible to access all commands for
a single Repository
. The RepositoryService
is only access
able from the RepositoryServiceFactory
.Note: Not every
RepositoryService
supports every command. If
the command is not supported the method will trow a
CommandNotSupportedException
. It is possible to check if the command
is supported by the RepositoryService
with the
isSupported(Command)
method.Warning: You should always close the connection to the repository after work is finished. For closing the connection to the repository use the
close()
method.- Since:
- 1.17
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the connection to the repository and releases all locks and resources.The blame command shows changeset information by line for a given file.The branch command creates new branches.Get details for a branch.The branches command list all repository branches.The browse command allows browsing of a repository.The bundle command creates an archive from the repository.The cat command show the content of a given file.The diff command shows differences between revisions for a specified file or the entire revision.The diff command shows differences between revisions for a specified file or the entire revision.The full health check command inspects a repository in a way, that might take a while in contrast to the light checks executed at startup.The incoming command shows newChangeset
s found in a different repository location.Lock and unlock files.The log command shows revision history of entire repository or files.The lookup command executes a lookup which returns additional information for the repository.The merge command executes a merge of two branches.The mirror command creates a 'mirror' of an existing repository (specified by a URL) by copying all data to the repository of this service.The modification command shows file modifications in a revision.The modify command makes changes to the head of a branch.The outgoing command showChangeset
s not found in a remote repository.<T extends ScmProtocol>
TgetProtocol
(Class<T> clazz) The pull command pull changes from a other repository.The push command pushes changes to a other repository.Returns the repository of this service.The tag command allows the management of repository tags.The tags command list all repository tag.The unbundle command restores a repository from the given bundle.boolean
isSupported
(Command command) Returns true if the command is supported by the repository service.boolean
isSupported
(Feature feature) Returns true if the feature is supported by the repository service.
-
Method Details
-
close
public void close()Closes the connection to the repository and releases all locks and resources. This method should be called in a finally block e.g.:RepositoryService service = null; try { service = factory.create("repositoryId"); // do something with the service } finally { if ( service != null ){ service.close(); } }
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getBlameCommand
The blame command shows changeset information by line for a given file.- Returns:
- instance of
BlameCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBranchesCommand
The branches command list all repository branches.- Returns:
- instance of
BranchesCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBranchCommand
The branch command creates new branches.- Returns:
- instance of
BranchCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBrowseCommand
The browse command allows browsing of a repository.- Returns:
- instance of
BrowseCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getBundleCommand
The bundle command creates an archive from the repository.- Returns:
- instance of
BundleCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.43
-
getCatCommand
The cat command show the content of a given file.- Returns:
- instance of
CatCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getDiffCommand
The diff command shows differences between revisions for a specified file or the entire revision.- Returns:
- instance of
DiffCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getDiffResultCommand
The diff command shows differences between revisions for a specified file or the entire revision.- Returns:
- instance of
DiffResultCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getIncomingCommand
The incoming command shows newChangeset
s found in a different repository location.- Returns:
- instance of
IncomingCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getLogCommand
The log command shows revision history of entire repository or files.- Returns:
- instance of
LogCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getModificationsCommand
The modification command shows file modifications in a revision.- Returns:
- instance of
ModificationsCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getOutgoingCommand
The outgoing command showChangeset
s not found in a remote repository.- Returns:
- instance of
OutgoingCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getPullCommand
The pull command pull changes from a other repository.- Returns:
- instance of
PullCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getPushCommand
The push command pushes changes to a other repository.- Returns:
- instance of
PushCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.31
-
getRepository
Returns the repository of this service.- Returns:
- repository of this service
-
getTagsCommand
The tags command list all repository tag.- Returns:
- instance of
TagsCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getTagCommand
The tag command allows the management of repository tags.- Returns:
- instance of
TagCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.
-
getUnbundleCommand
The unbundle command restores a repository from the given bundle.- Returns:
- instance of
UnbundleCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 1.43
-
getMergeCommand
The merge command executes a merge of two branches. It is possible to do a dry run to check, whether the given branches can be merged without conflicts.- Returns:
- instance of
MergeCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.0.0
-
getModifyCommand
The modify command makes changes to the head of a branch. It is possible to- create new files
- delete existing files
- modify/replace files
- move files
- Returns:
- instance of
ModifyCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.0.0
-
getLookupCommand
The lookup command executes a lookup which returns additional information for the repository.- Returns:
- instance of
LookupCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.10.0
-
getFullCheckCommand
The full health check command inspects a repository in a way, that might take a while in contrast to the light checks executed at startup.- Returns:
- instance of
FullHealthCheckCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.17.0
-
getMirrorCommand
The mirror command creates a 'mirror' of an existing repository (specified by a URL) by copying all data to the repository of this service. Therefore this repository has to be empty (otherwise the behaviour is not specified).- Returns:
- instance of
MirrorCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.19.0
-
getLockCommand
Lock and unlock files.- Returns:
- instance of
FileLockCommandBuilder
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.26.0
-
getBranchDetailsCommand
Get details for a branch.- Returns:
- instance of
BranchDetailsCommand
- Throws:
CommandNotSupportedException
- if the command is not supported by the implementation of the repository service provider.- Since:
- 2.28.0
-
getChangesetsCommand
-
isSupported
Returns true if the command is supported by the repository service.- Parameters:
command
- command- Returns:
- true if the command is supported
-
isSupported
Returns true if the feature is supported by the repository service.- Parameters:
feature
- feature- Returns:
- true if the feature is supported
- Since:
- 1.25
-
getSupportedProtocols
-
getProtocol
-