Jump to >

rbtools.utils.repository

Utility functions for working with repositories.

Functions

get_repository_id(repository_info, api_root)

Return the ID of a repostiory from the server.

get_repository_resource(api_root[, tool, ...])

Return the API resource for the matching repository on the server.

rbtools.utils.repository.get_repository_resource(api_root, tool=None, repository_name=None, repository_paths=None)[source]

Return the API resource for the matching repository on the server.

New in version 3.0.

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 (unicode, optional) – An explicit repository name provided by the local configuration.

  • repository_paths (list or unicode, optional) – A list of potential paths to match for the repository.

Returns:

A 2-tuple of ItemResource. The first item is the matching repository, and the second is the repository info resource.

Return type:

tuple of rbtools.api.resource.ItemResource

rbtools.utils.repository.get_repository_id(repository_info, api_root, repository_name=None)[source]

Return the ID of a repostiory 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:
Returns:

The ID of the repository, or None if not found.

Return type:

int