b.config : module documentation

Part of bzrlib

Configuration that affects the behaviour of Bazaar.

Currently this configuration resides in ~/.bazaar/bazaar.conf
and ~/.bazaar/locations.conf, which is written to by bzr.

In bazaar.conf the following options may be set:
email=Your Name <your@email.address>

in locations.conf, you specify the url of a branch and options for it.
Wildcards may be used - * and ? as normal in shell completion. Options
set in both bazaar.conf and locations.conf are overridden by the locations.conf
email= as above
check_signatures= as above
create_signatures= as above.
validate_signatures_in_log=as above
acceptable_keys=as above

explanation of options
editor - this option sets the pop up editor to use during commits.
email - this option sets the user id bzr will use when committing.
check_signatures - this option will control whether bzr will require good gpg
                   signatures, ignore them, or check them if they are
                   present.  Currently it is unused except that check_signatures
                   turns on create_signatures.
create_signatures - this option controls whether bzr will always create
                    gpg signatures or not on commits.  There is an unused
                    option which in future is expected to work if               
                    branch settings require signatures.
log_format - this option sets the default log format.  Possible values are
             long, short, line, or a plugin can register new formats.
validate_signatures_in_log - show GPG signature validity in log output
acceptable_keys - comma separated list of key patterns acceptable for
                  verify-signatures command

In bazaar.conf you can also define aliases in the ALIASES sections, example

lastlog=log --line -r-10..-1
ll=log --line -r-10..-1
Class ConfigObj Undocumented
Class Config A configuration policy - what username, editor, gpg needs etc.
Class IniBasedConfig A configuration policy that draws from ini files.
Class LockableConfig A configuration needing explicit locking for access.
Class GlobalConfig The configuration that should be used for a specific location.
Class LocationConfig A configuration object that gives the policy for a location.
Class BranchConfig A configuration object giving the policy for a branch.
Function ensure_config_dir_exists Make sure a configuration directory exists.
Function config_dir Return per-user configuration directory.
Function config_filename Return per-user configuration ini file filename.
Function locations_config_filename Return per-user configuration ini file filename.
Function authentication_config_filename Return per-user authentication ini file filename.
Function user_ignore_config_filename Return the user default ignore filename
Function crash_dir Return the directory name to store crash files.
Function xdg_cache_dir Undocumented
Function parse_username Parse e-mail username and return a (name, address) tuple.
Function extract_email_address Return just the address part of an email string.
Class TreeConfig Branch configuration data associated with its contents, not location
Class AuthenticationConfig The authentication configuration file based on a ini file.
Class CredentialStoreRegistry A class that registers credential stores.
Class CredentialStore An abstract class to implement storage for credentials
Class PlainTextCredentialStore No class docstring; 1/1 methods documented
Class BzrDirConfig No class docstring; 2/3 methods documented
Class TransportConfig A Config that reads/writes a config file on a Transport.
Class Option An option definition.
Function bool_from_store Undocumented
Function int_from_store Undocumented
Function float_from_store Undocumented
Function list_from_store Undocumented
Class OptionRegistry Register config options by their name.
Class Section A section defines a dict of option name => value.
Class MutableSection A section allowing changes and keeping track of the original values.
Class CommandLineSection A section used to carry command line overrides for the config options.
Class Store Abstract interface to persistent storage for configuration options.
Class IniFileStore A config Store using ConfigObj for storage.
Class LockableIniFileStore A ConfigObjStore using locks on save to ensure store integrity.
Class GlobalStore Undocumented
Class LocationStore Undocumented
Class BranchStore Undocumented
Class ControlStore Undocumented
Class SectionMatcher Select sections into a given Store.
Class NameMatcher Undocumented
Class LocationSection Undocumented
Class LocationMatcher No class docstring; 1/3 methods documented
Class Stack A stack of configurations where an option can be defined
Class GlobalStack Global options only stack.
Class LocationStack Per-location options falling back to global options stack.
Class BranchStack Per-location options falling back to branch then global options stack.
Class RemoteControlStack Remote control-only options stack.
Class RemoteBranchStack Remote branch-only options stack.
Class cmd_config No class docstring; 1/6 methods documented
Function _get_expand_default_value Undocumented
Class _ConfigHooks A dict mapping hook names and a list of callables for configs.
Class _OldConfigHooks A dict mapping hook names and a list of callables for configs.
Function _iter_for_location_by_parts Keep only the sessions matching the specified location.
Function _get_default_mail_domain If possible, return the assumed default email domain.
Function _auto_user_id Calculate automatic user identification.
Class _CompatibleStack Place holder for compatibility with previous design.
def _get_expand_default_value():
def _iter_for_location_by_parts(sections, location):
Keep only the sessions matching the specified location.

location will always be a local path and never a 'file://' url but the section names themselves can be in either form.

ParameterssectionsAn iterable of section names.
locationAn url or a local path to match against.
ReturnsAn iterator of (section, extra_path, nb_parts) where nb is the number of path components in the section name, section is the section name and extra_path is the difference between location and the section name.
def ensure_config_dir_exists(path=None):
Make sure a configuration directory exists. This makes sure that the directory exists. On windows, since configuration directories are 2 levels deep, it makes sure both the directory and the parent directory exists.
def config_dir():
Return per-user configuration directory.

By default this is %APPDATA%/bazaar/2.0 on Windows, ~/.bazaar on Mac OS X and Linux. On Linux, if there is a $XDG_CONFIG_HOME/bazaar directory, that will be used instead.

TODO: Global option --config-dir to override this.

def config_filename():
Return per-user configuration ini file filename.
def locations_config_filename():
Return per-user configuration ini file filename.
def authentication_config_filename():
Return per-user authentication ini file filename.
def user_ignore_config_filename():
Return the user default ignore filename
def crash_dir():
Return the directory name to store crash files.

This doesn't implicitly create it.

On Windows it's in the config directory; elsewhere it's /var/crash which may be monitored by apport. It can be overridden by $APPORT_CRASH_DIR.

def xdg_cache_dir():
def _get_default_mail_domain():
If possible, return the assumed default email domain.
Returnsstring mail domain, or None.
def _auto_user_id():
Calculate automatic user identification.

:returns: (realname, email), either of which may be None if they can't be

Only used when none is set in the environment or the id file.

This only returns an email address if we can be fairly sure the 
address is reasonable, ie if /etc/mailname is set on unix.

This doesn't use the FQDN as the default domain because that may be 
slow, and it doesn't use the hostname alone because that's not normally 
a reasonable address.
def parse_username(username):
Parse e-mail username and return a (name, address) tuple.
def extract_email_address(e):

Return just the address part of an email string.

That is just the user@domain part, nothing else. This part is required to contain only ascii characters. If it can't be extracted, raises an error.

>>> extract_email_address('Jane Tester <jane@test.com>')
def bool_from_store(unicode_str):
def int_from_store(unicode_str):
def float_from_store(unicode_str):
def list_from_store(unicode_str):
API Documentation for Bazaar, generated by pydoctor at 2022-05-20 00:29:02.