Jump to >

rbtools.clients.base.repository

Classes for representing source code repositories.

New in version 4.0.

Classes

RepositoryInfo(*[, path, base_path, local_path])

A representation of a source code repository.

class rbtools.clients.base.repository.RepositoryInfo(*, path: Optional[Union[str, List[str]]] = None, base_path: Optional[str] = None, local_path: Optional[str] = None)[source]

Bases: object

A representation of a source code repository.

Changed in version 4.0:

  • Moved from rbtools.clients. That module still provides compatibility imports.

  • Removed the deprecated name, supports_changesets, and supports_parent_diffs attributes.

  • Removed the deprecated find_server_repository_info() method.

__init__(*, path: Optional[Union[str, List[str]]] = None, base_path: Optional[str] = None, local_path: Optional[str] = None) None[source]

Initialize the object.

Changed in version 4.0:

  • The name, supports_changesets, and supports_parent_diffs arguments have been removed.

  • All arguments must be passed in as keyword arguments. This will be required in RBTools 5.

Changed in version 3.0:

  • The name argument was deprecated. Clients which allow configuring the repository name in metadata should instead implement get_repository_name().

  • The supports_changesets and supports_parent_diffs arguments were deprecated. Clients which need these should instead set supports_changesets and supports_parent_diffs on themselves.

Parameters:
  • path (str or list of str, optional) –

    The path of the repository, or a list of possible paths (with the primary one appearing first).

    This can be empty by default, if the caller expects to later populate it with update_from_remote().

  • base_path (str, optional) – The relative path between the current working directory and the repository root.

  • local_path (str, optional) – The local filesystem path for the repository. This can sometimes be the same as path, but may not be (since that can contain a remote repository path).

  • name (str, optional) – The name of the repository, as configured on Review Board. This might be available through some repository metadata.

  • supports_changesets (bool, optional) – Whether the repository type supports changesets that store their data server-side.

  • supports_parent_diffs (bool, optional) – Whether the repository type supports posting changes with parent diffs.

path: Optional[Union[str, List[str]]]

The path of the repository, or a list of possible paths.

This may be empty.

Type:

str or list of str

base_path: Optional[str]

Relative path between the working directory and repository root.

This is dependent on the type of SCM, and may be empty.

Type:

str

local_path: Optional[str]

The local filesystem path for the repository.

This can sometimes be the same as path, but may not be (since that can contain a remote repository path).

Type:

str

__repr__() str[source]

Return a string representation of the repository info.

Returns:

The string representation.

Return type:

str

__str__() str[source]

Return a human-readable representation of the repository info.

Returns:

The string representation.

Return type:

str

set_base_path(base_path: str) None[source]

Set the base path of the repository info.

Parameters:

base_path (str) – The relative path between the current working directory and the repository root.

update_from_remote(repository: ItemResource, info: ItemResource) None[source]

Update the info from a remote repository.

Subclasses may override this to fetch additional data from the server.

By defaut, this simply sets the path based on the repository.

Parameters: