rbtools.clients.bazaar¶
A client for Bazaar and Breezy.
Classes
|
A client for Bazaar and Breezy. |
- class rbtools.clients.bazaar.BazaarClient(**kwargs)[source]¶
Bases:
BaseSCMClient
A client for Bazaar and Breezy.
This is a wrapper that fetches repository information and generates compatible diffs.
It supports the legacy Bazaar client, as well as the modern Breezy.
Changed in version 2.0.1: Added support for Breezy.
- scmclient_id: str = 'bazaar'[source]¶
The unique ID of the client.
New in version 4.0: This will be required in RBTools 5.0.
- Type:
- server_tool_names: ClassVar[Optional[str]] = 'Bazaar'[source]¶
A comma-separated list of SCMClient names on the server.
New in version 3.0.
- Type:
- server_tool_ids: ClassVar[Optional[List[str]]] = ['bazaar'][source]¶
A comma-separated list of SCMClient IDs on the server.
This supersedes
server_tool_names
when running on a version of Review Board that supports passing tool IDs to the repositories list API.New in version 5.0.1.
- Type:
- supports_diff_exclude_patterns: bool = True[source]¶
Whether the SCM client supports excluding files from the diff.
- Type:
- supports_parent_diffs: bool = True[source]¶
Whether the SCM client supports generating parent diffs.
New in version 3.0.
- Type:
- BRANCH_REGEX = '\\w*(repository branch|branch root|checkout root|checkout of branch): (?P<branch_path>.+)$'[source]¶
- __init__(**kwargs) None [source]¶
Initialize the client.
- Parameters:
**kwargs (
dict
) – Keyword arguments to pass through to the base class.
- property bzr: str[source]¶
The name of the command line tool for Breezy or Bazaar.
Callers must call
setup()
orhas_dependencies()
before accessing this. This will be required starting in RBTools 5.0.This will fall back to “bzr” if neither Bazaar nor Breezy is installed.
- Type:
- property is_breezy: bool[source]¶
Whether the client will be working with Breezy, instead of Bazaar.
Callers must call
setup()
orhas_dependencies()
before accessing this. This will be required starting in RBTools 5.0.- Type:
- check_dependencies() None [source]¶
Check whether the base dependencies needed are available.
This will check for both brz (Breezy) or bzr (which may be Bazaar or a Breezy symlink).
New in version 4.0.
- Raises:
rbtools.clients.errors.SCMClientDependencyError – Neither bzr nor brz could be found.
- get_local_path() Optional[str] [source]¶
Return the local path to the working tree.
- Returns:
The filesystem path of the repository on the client system.
- Return type:
- get_repository_info() Optional[RepositoryInfo] [source]¶
Return repository information for the current working tree.
- Returns:
The repository info structure.
- Return type:
- parse_revision_spec(revisions: List[str] = []) SCMClientRevisionSpec [source]¶
Parse the given revision spec.
These will be used to generate the diffs to upload to Review Board (or print). The diff for review will include the changes in (base, tip], and the parent diff (if necessary) will include (parent, base].
If a single revision is passed in, this will return the parent of that revision for “base” and the passed-in revision for “tip”.
If zero revisions are passed in, this will return the current HEAD as ‘tip’, and the upstream branch as ‘base’, taking into account parent branches explicitly specified via
--parent
.- Parameters:
revisions (
list
ofstr
, optional) – A list of revisions as specified by the user.- Returns:
The parsed revision spec.
See
SCMClientRevisionSpec
for the format of this dictionary.This always populates
base
andtip
.parent_base
will be populated if using--parent
.- Return type:
- Raises:
rbtools.clients.errors.InvalidRevisionSpecError – The given revisions could not be parsed.
rbtools.clients.errors.TooManyRevisionsError – The specified revisions list contained too many revisions.
- diff(revisions: SCMClientRevisionSpec, *, include_files: List[str] = [], exclude_patterns: List[str] = [], **kwargs) SCMClientDiffResult [source]¶
Perform a diff using the given revisions.
If the revision spec is empty, this returns the diff of the current branch with respect to its parent. If a single revision is passed in, this returns the diff of the change introduced in that revision. If two revisions are passed in, this will do a diff between those two revisions.
- Parameters:
revisions (
dict
) – A dictionary of revisions, as returned byparse_revision_spec()
.include_files (
list
ofstr
, optional) – A list of files to whitelist during the diff generation.exclude_patterns (
list
ofstr
, optional) – A list of shell-style glob patterns to blacklist during diff generation.extra_args (
list
, unused) – Additional arguments to be passed to the diff generation. Unused for Bazaar.**kwargs (
dict
, unused) – Unused keyword arguments.
- Returns:
A dictionary containing keys documented in
SCMClientDiffResult
.This will only populate the
diff
key.- Return type:
- get_raw_commit_message(revisions: SCMClientRevisionSpec) str [source]¶
Extract the commit message based on the provided revision range.