rbtools.utils.repository¶
Utility functions for working with repositories.
Functions
|
Return the ID of a repository from the server. |
|
Return the API resource for the matching repository on the server. |
- rbtools.utils.repository.get_repository_resource(api_root: RootResource, tool: Optional[BaseSCMClient] = None, repository_name: Optional[str] = None, repository_paths: Optional[Union[str, list[str]]] = None, capabilities: Optional[Capabilities] = None) tuple[Optional[ItemResource], Optional[ItemResource]] [source]¶
Return the API resource for the matching repository on the server.
New in version 3.0.
Changed in version 5.0.1: Added the
capabilities
argument.- Parameters:
api_root (
rbtools.api.resource.RootResource
) – The root resource for the API.tool (
rbtools.clients.base.BaseSCMClient
, optional) – The SCM client corresponding to the local working directory.repository_name (
str
, optional) – An explicit repository name provided by the local configuration.repository_paths (
list
orstr
, optional) – A list of potential paths to match for the repository.capabilities (
rbtools.api.capabilities.Capabilities
, optional) – The capabilities fetched from the server.
- Returns:
A 2-tuple of
ItemResource
. The first item is the matching repository, and the second is the repository info resource.- Return type:
- rbtools.utils.repository.get_repository_id(repository_info: RepositoryInfo, api_root: RootResource, repository_name: Optional[str] = None) Optional[int] [source]¶
Return the ID of a repository from the server.
This will look up all accessible repositories on the server and try to find the ID of one that matches the provided repository information.
- Parameters:
repository_info (
rbtools.clients.base.repository.RepositoryInfo
) – The scanned repository information.api_root (
rbtools.api.resource.RootResource
) – The root resource for the API.repository_name (
str
, optional) – An explicit repository name provided by local configuration.
- Returns:
The ID of the repository, or
None
if not found.- Return type: