b.c.ControlDirFormat(object) : class documentation

Part of bzrlib.controldir View In Hierarchy

Known subclasses: bzrlib.bzrdir.BzrDirFormat, bzrlib.tests.test_controldir.NotBzrDirFormat

An encapsulation of the initialization and open routines for a format.

Formats provide three things:
  • An initialization routine,
  • a format string,
  • an open routine.

Formats are placed in a dict by their format string for reference during controldir opening. These should be subclasses of ControlDirFormat for consistency.

Once a format is deprecated, just deprecate the initialize and open methods on the format class. Do not deprecate the object, as the object will be created every system load.

Class Variablescolocated_branchesWhether this formats supports colocated branches.
supports_workingtreesThis control directory can co-exist with a working tree.
Method get_format_description Return the short description for this format.
Method get_converter Return the converter to use to convert controldirs needing converts.
Method is_supported Is this format supported?
Method is_initializable Whether new control directories of this format can be initialized.
Method check_support_status Give an error or warning on old formats.
Method same_model Undocumented
Class Method register_format Register a format that does not use '.bzr' for its control dir.
Class Method register_prober Register a prober that can look for a control dir.
Class Method unregister_prober Unregister a prober.
Class Method register_server_prober Register a control format prober for client-server environments.
Method __str__ Undocumented
Class Method known_formats Return all the known formats.
Class Method find_format Return the format present at transport.
Method initialize Create a control dir at this url and return an opened copy.
Method initialize_on_transport Initialize a new controldir in the base directory of a Transport.
Method initialize_on_transport_ex Create this format on transport.
Method network_name A simple byte string uniquely identifying this format for RPC calls.
Method open Return an instance of this format for the dir transport points at.
Class Method get_default_format Return the current default format.
Method supports_transport Check if this format can be opened over a particular transport.
Class Method _set_default_format Set default format (for testing behavior of defaults only)
def get_format_description(self):
Return the short description for this format.
def get_converter(self, format=None):
Return the converter to use to convert controldirs needing converts.

This returns a bzrlib.controldir.Converter object.

This should return the best upgrader to step this format towards the current default format. In the case of plugins we can/should provide some means for them to extend the range of returnable converters.

ParametersformatOptional format to override the default format of the library.
def is_supported(self):
Is this format supported?

Supported formats must be openable. Unsupported formats may not support initialization or committing or some other features depending on the reason for not being supported.

def is_initializable(self):
Whether new control directories of this format can be initialized.
def check_support_status(self, allow_unsupported, recommend_upgrade=True, basedir=None):
Give an error or warning on old formats.
Parametersallow_unsupportedIf true, allow opening formats that are strongly deprecated, and which may have limited functionality.
recommend_upgradeIf true (default), warn the user through the ui object that they may wish to upgrade the object.
def same_model(self, target_format):
Undocumented
@classmethod
def register_format(klass, format):
Register a format that does not use '.bzr' for its control dir.
@classmethod
def register_prober(klass, prober):
Register a prober that can look for a control dir.
@classmethod
def unregister_prober(klass, prober):
Unregister a prober.
@classmethod
def register_server_prober(klass, prober):
Register a control format prober for client-server environments.

These probers will be used before ones registered with register_prober. This gives implementations that decide to the chance to grab it before anything looks at the contents of the format file.

def __str__(self):
Undocumented
@classmethod
def known_formats(klass):
Return all the known formats.
@classmethod
def find_format(klass, transport, _server_formats=True):
Return the format present at transport.
def initialize(self, url, possible_transports=None):
Create a control dir at this url and return an opened copy.

While not deprecated, this method is very specific and its use will lead to many round trips to setup a working environment. See initialize_on_transport_ex for a [nearly] all-in-one method.

Subclasses should typically override initialize_on_transport instead of this method.

def initialize_on_transport(self, transport):
Initialize a new controldir in the base directory of a Transport.
def initialize_on_transport_ex(self, transport, use_existing_dir=False, create_prefix=False, force_new_repo=False, stacked_on=None, stack_on_pwd=None, repo_format_name=None, make_working_trees=None, shared_repo=False, vfs_only=False):
Create this format on transport.

The directory to initialize will be created.

Parametersforce_new_repoDo not use a shared repository for the target, even if one is available.
create_prefixCreate any missing directories leading up to to_transport.
use_existing_dirUse an existing directory if one exists.
stacked_onA url to stack any created branch on, None to follow any target stacking policy.
stack_on_pwdIf stack_on is relative, the location it is relative to.
repo_format_nameIf non-None, a repository will be made-or-found. Should none be found, or if force_new_repo is True the repo_format_name is used to select the format of repository to create.
make_working_treesControl the setting of make_working_trees for a new shared repository when one is made. None to use whatever default the format has.
shared_repoControl whether made repositories are shared or not.
vfs_onlyIf True do not attempt to use a smart server
Returnsrepo, controldir, require_stacking, repository_policy. repo is None if none was created or found, controldir is always valid. require_stacking is the result of examining the stacked_on parameter and any stacking policy found for the target.
def network_name(self):
A simple byte string uniquely identifying this format for RPC calls.

Bzr control formats use this disk format string to identify the format over the wire. Its possible that other control formats have more complex detection requirements, so we permit them to use any unique and immutable string they desire.

def open(self, transport, _found=False):
Return an instance of this format for the dir transport points at.
@classmethod
def _set_default_format(klass, format):
Set default format (for testing behavior of defaults only)
@classmethod
def get_default_format(klass):
Return the current default format.
def supports_transport(self, transport):
Check if this format can be opened over a particular transport.
API Documentation for Bazaar, generated by pydoctor at 2019-10-22 00:34:23.