rbtools.config.config¶
Configuration for RBTools.
These classes manage access to loaded RBTools configuration, and provide type hints for all RBTools-provided settings.
New in version 5.0.
Module Attributes
A dictionary storing raw configuration data. |
Classes
|
Configuration for terminal colors. |
|
Wrapper for configuration data. |
|
A flag indicating whether to guess state. |
|
Configuration for a .reviewboardrc file. |
- rbtools.config.config.ConfigDict¶
A dictionary storing raw configuration data.
- class rbtools.config.config.ConfigData(*, config_dict: Dict[str, Any] = {}, filename: Optional[str] = None)[source]¶
Bases:
object
Wrapper for configuration data.
This stores raw configuration data, providing both dictionary-like and attribute-like access to it, as well as allowing subclasses to wrap dictionaries in another
ConfigData
instance.Subclasses are expected to add type annotations for every known field that should be accessed through the class.
- __init__(*, config_dict: Dict[str, Any] = {}, filename: Optional[str] = None) None [source]¶
Initialize the configuration data wrapper.
- copy() Self [source]¶
Return a copy of this configuration data.
- Returns:
A copy of this instance’s class with a copy of the data.
- Return type:
- get(key, default: Any = None) Any [source]¶
Return a value from a configuration item.
This will return the value from the loaded configuration data, falling back to class-specified default value or the provided default value.
This helps emulate dictionary-based access.
- merge(other_config: ConfigData) None [source]¶
Merge other configuration into this one.
Any
ConfigData
or dictionary values will be merged recursively.- Parameters:
other_config (
ConfigData
) – The configuration data to merge in.
- __eq__(other: Any) bool [source]¶
Return whether this configuration is equal toa nother.
Configurations are equal if they are of the same type and have the same stored settings.
The filename is not factored in.
- __contains__(key: str) bool [source]¶
Return whether a key is found in the configuration.
A key will be considered found if it either has a default value or is present in the loaded configuration data.
- __getattribute__(name: str) Any [source]¶
Return the value for a configuration key as an attribute.
This will return the value from the loaded configuration data, falling back to class-specified default value if one exists.
- Parameters:
name (
str
) – The configuration key.- Returns:
The configuration value, if found or if it has a default.
- Return type:
- Raises:
AttributeError – The configuration key or default was not found.
- __getitem__(name: str) Any [source]¶
Return the value for a configuration key as a dictionary key.
This will return the value from the loaded configuration data, falling back to class-specified default value if one exists.
- __set_name__(owner: Type, name: str) None [source]¶
Handle an assignment of this instance to a class.
If setting this on another
ConfigData
, this will be registered in the owner class’s list of wrappers.
- __repr__() str [source]¶
Return a string representation of the configuration data.
- Returns:
The string representation.
- Return type:
- __hash__ = None¶
- class rbtools.config.config.GuessFlag(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
-
A flag indicating whether to guess state.
New in version 5.0.
- __format__(format_spec)¶
Return a formatted version of the string as described by format_spec.
- __new__(value)¶
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- class rbtools.config.config.ColorsConfig(*, config_dict: Dict[str, Any] = {}, filename: Optional[str] = None)[source]¶
Bases:
ConfigData
Configuration for terminal colors.
New in version 5.0.
- class rbtools.config.config.RBToolsConfig(*, config_dict: Dict[str, Any] = {}, filename: Optional[str] = None)[source]¶
Bases:
ConfigData
Configuration for a .reviewboardrc file.
New in version 5.0.
- COLOR: ColorsConfig = <RBToolsConfig(filename=None, config={})>¶
Colors used for log/text output.
New in version 1.0.
- API_TOKEN: Optional[str] = None¶
An API token to use for authentication.
This takes place over a password.
New in version 0.7.
- EXT_AUTH_COOKIES: Optional[str] = None¶
The path to an external cookies file with pre-fetched cookies.
This is useful with servers that require extra web authentication to access the Review Board server itself, such as certain Single Sign-On services or proxies.
New in version 0.7.5.
- WEB_LOGIN: bool = False¶
Whether to default to using web-based login for authentication.
If this is set, web-based login will be used instead of prompting for authentication credentials in the terminal.
New in version 5.0.
- PROXY_AUTHORIZATION: Optional[str] = None¶
A value to send in Proxy-Authorization headers for HTTP requests.
This can be used to authenticate with proxy services.
- CACHE_LOCATION: Optional[str] = None¶
The file to use for the API cache database.
If not explicitly provided, a default will be chosen.
New in version 0.7.3.
- DISABLE_CACHE: bool = False¶
Whether to disable HTTP caching completely.
This will result in slower requests.
New in version 0.7.3.
- IN_MEMORY_CACHE: bool = False¶
Whether to use an in-memory cache, instead of writing to disk.
New in version 0.7.3.
- CLIENT_CERT: Optional[str] = None¶
A path to a SSL/TLS certificate for communicating with the server.
- REPOSITORY: Optional[str] = None¶
The name of the repository on Review Board to communicate with.
Changed in version 0.6: This previously supported taking a configured repository URL. That now must be provided in
REPOSITORY_URL
.
- REPOSITORY_TYPE: Optional[str] = None¶
The type of the repository on Review Board.
This must be a value found in rbt list-repo-types.
- REPOSITORY_URL: Optional[str] = None¶
The URL to the repository.
This can be used to override the detected URL for some SCMs or to influence certain operations.
For Subversion, this can be used to generate a diff outside of a working copy.
For Git, this can override the origin URL.
Changed in version 0.6: This previously supported taking a configured repository name. That now must be provided in
REPOSITORY
.
- TREES: Dict[str, Any] = {}¶
A mapping of repository paths to configuration data.
Deprecated since version 3.0: This should no longer be used. This functionality is scheduled to be removed in a future version.
- BASEDIR: Optional[str] = None¶
The path within the repository where the diff is generated.
This will be prepended to any relative URLs in the path. Specifying this overrides any detected paths.
It’s currently only supported for Subversion, usually when using
--diff-filename
options.
- EXCLUDE_PATTERNS: List[str] = []¶
A list of file patterns to exclude from the diff.
New in version 0.7.
- PARENT_BRANCH: Optional[str] = None¶
The parent branch the generate diffs relative to.
This is only supported by some SCMs. In general, this should not be used. Instead, revision ranges should be provided.
- TRACKING_BRANCH: Optional[str] = None¶
The remote tracking branch that the local branch corresponds to.
This is used for Git and Mercurial, and will override any automatic tracking branch detection implemented by the SCM client.
- BRANCH: Optional[str] = None¶
The value of the Branch field on a review request.
This will update the field when posting a change for review using :rbt-command:`post`.
Other commands may use it to inspect client-side defaults, but it’s recommended to inspect the review request where possible.
- DEPENDS_ON: Optional[str] = None¶
A comma-separated list of review request IDs to depend on.
This will update the field when posting a change for review using :rbt-command:`post`.
Other commands may use it to inspect client-side defaults, but it’s recommended to inspect the review request where possible.
New in version 0.6.1.
- MARKDOWN: bool = False¶
Whether to enable Markdown for any text content.
If set, review request, review, and comment text content will be uploaded in Markdown format.
New in version 0.6.
- TARGET_GROUPS: Optional[str] = None¶
A comma-separated list of group names to list as reviewers.
This will update the field when posting a change for review using :rbt-command:`post`.
Other commands may use it to inspect client-side defaults, but it’s recommended to inspect the review request where possible.
- TARGET_PEOPLE: Optional[str] = None¶
A comma-separated list of usernames to list as reviewers.
This will update the field when posting a change for review using :rbt-command:`post`.
Other commands may use it to inspect client-side defaults, but it’s recommended to inspect the review request where possible.
- SVN_PROMPT_PASSWORD: bool = False¶
Whether to prompt for a user’s Subversion password.
New in version 0.7.3.
- TF_CMD: Optional[str] = None¶
The full path to the tf command.
This will override any detected path.
New in version 0.7.6.
- LAND_DELETE_BRANCH: bool = True¶
Whether to delete the local branch when landed.
This is only used when deleting local branches.
New in version 0.7.
- LAND_DEST_BRANCH: Optional[str] = None¶
The name of a destination branch that changes should land on.
This is required when landing.
New in version 0.7.
- LAND_PUSH: bool = False¶
Whether to push the destination branch after landing the change.
New in version 0.7.
- LAND_SQUASH: bool = False¶
Whether to squash multiple commits into one when landing.
New in version 0.7.
- GUESS_FIELDS: Optional[str] = 'auto'¶
Whether to guess and set review request fields from a commit.
This will control the values for the following settings:
- GUESS_DESCRIPTION: Optional[GuessFlag] = None¶
Whether to guess and set a review request description from a commit.
- GUESS_SUMMARY: Optional[GuessFlag] = None¶
Whether to guess and set a review request summary from a commit.
- PUBLISH: bool = False¶
Whether to publish a change immediately after posting it.
To succeed, all required fields must already be filled in on the review request.
- SQUASH_HISTORY: bool = False¶
Whether to create the review request in legacy single-commit mode.
If set, the review request will not be able to display multi-commit reviews.
This should be considered a legacy setting.
New in version 2.0.
- STAMP_WHEN_POSTING: bool = False¶
Whether to stamp the commit message with the review request URL.
This is used by :rbt-command:`post` to perform the stamping once posted.
New in version 0.7.3.
- SUBMIT_AS: Optional[str] = None¶
A username to use as the author of the review request.
This requires the logged-in user to have the special
reviews.can_submit_as
permission. See Automating rbt post.