rbtools.clients.base.repository¶
Classes for representing source code repositories.
New in version 4.0.
Classes
|
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
, andsupports_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
, andsupports_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 implementget_repository_name()
.The
supports_changesets
andsupports_parent_diffs
arguments were deprecated. Clients which need these should instead setsupports_changesets
andsupports_parent_diffs
on themselves.
- Parameters:
path (
str
orlist
ofstr
, 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 aspath
, 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.
- 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:
- 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:
- __repr__() str [source]¶
Return a string representation of the repository info.
- Returns:
The string representation.
- Return type:
- __str__() str [source]¶
Return a human-readable representation of the repository info.
- Returns:
The string representation.
- Return type:
- 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: Optional[ItemResource]) None [source]¶
Update the info from a remote repository.
Subclasses may override this to fetch additional data from the server.
By default, this simply sets the path based on the
repository
.- Parameters:
repository (
rbtools.api.resource.ItemResource
) – The repository resource.info (
rbtools.api.resource.ItemResource
, unused) –The repository info resource.
This is not used by default, but is available to callers.