b.b.BranchFormat(controldir.ControlComponentFormat) : class documentation

Part of bzrlib.branch View In Hierarchy

Known subclasses: bzrlib.branch.BranchFormatMetadir, bzrlib.plugins.weave_fmt.branch.BzrBranchFormat4, bzrlib.remote.RemoteBranchFormat, bzrlib.tests.per_bzrdir.test_bzrdir.AnonymousTestBranchFormat, bzrlib.tests.per_bzrdir.test_bzrdir.IdentifiableTestBranchFormat, bzrlib.tests.test_branch.SampleBranchFormat, bzrlib.tests.test_branch.SampleExtraBranchFormat, bzrlib.tests.test_branch.SampleSupportedBranchFormat, bzrlib.tests.test_bzrdir._TestBranchFormat

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 an dict by their format string for reference during branch opening. It's not required that these be instances, they can be classes themselves with class methods - it simply depends on whether state is needed for a given format or not.

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 time regardless.

Method __eq__ Undocumented
Method __ne__ Undocumented
Class Method find_format Return the format for the branch object in controldir.
Class Method get_default_format Return the current default format.
Class Method get_formats Get all the known formats.
Method get_reference Get the target reference of the branch in controldir.
Class Method set_reference Set the target reference of the branch in controldir.
Method get_format_string Return the ASCII format string that identifies this format.
Method get_format_description Return the short format description for this format.
Method initialize Create a branch of this format in controldir.
Method is_supported Is this format supported?
Method make_tags Create a tags object for branch.
Method network_name A simple byte string uniquely identifying this format for RPC calls.
Method open Return the branch object for controldir.
Class Method register_format Register a metadir format.
Class Method set_default_format Undocumented
Method supports_set_append_revisions_only True if this format supports set_append_revisions_only.
Method supports_stacking True if this format records a stacked-on branch.
Method supports_leaving_lock True if this format supports leaving locks in place.
Class Method unregister_format Undocumented
Method __str__ Undocumented
Method supports_tags True if this format supports tags stored in the branch
Method tags_are_versioned Whether the tag container for this branch versions tags.
Method supports_tags_referencing_ghosts True if tags can reference ghost revisions.
Method _run_post_branch_init_hooks Undocumented

Inherited from ControlComponentFormat:

Method check_support_status Give an error or warning on old formats.
def __eq__(self, other):
Undocumented
def __ne__(self, other):
Undocumented
@classmethod
def find_format(klass, controldir, name=None):
Return the format for the branch object in controldir.
@classmethod
@deprecated_method(deprecated_in((2, 4, 0)))
def get_default_format(klass):
Return the current default format.
@classmethod
@deprecated_method(deprecated_in((2, 4, 0)))
def get_formats(klass):
Get all the known formats.

Warning: This triggers a load of all lazy registered formats: do not use except when that is desireed.

def get_reference(self, controldir, name=None):
Get the target reference of the branch in controldir.

format probing must have been completed before calling this method - it is assumed that the format of the branch in controldir is correct.

ParameterscontroldirThe controldir to get the branch data from.
nameName of the colocated branch to fetch
ReturnsNone if the branch is not a reference branch.
@classmethod
def set_reference(self, controldir, name, to_branch):
Set the target reference of the branch in controldir.

format probing must have been completed before calling this method - it is assumed that the format of the branch in controldir is correct.

ParameterscontroldirThe controldir to set the branch reference for.
nameName of colocated branch to set, None for default
to_branchbranch that the checkout is to reference
def get_format_string(self):
Return the ASCII format string that identifies this format.
def get_format_description(self):
Return the short format description for this format.
def _run_post_branch_init_hooks(self, controldir, name, branch):
Undocumented
def initialize(self, controldir, name=None, repository=None, append_revisions_only=None):
Create a branch of this format in controldir.
ParametersnameName of the colocated branch to create.
def is_supported(self):
Is this format supported?

Supported formats can be initialized and opened. Unsupported formats may not support initialization or committing or some other features depending on the reason for not being supported.

def make_tags(self, branch):
Create a tags object for branch.

This method is on BranchFormat, because BranchFormats are reflected over the wire via network_name(), whereas full Branch instances require multiple VFS method calls to operate at all.

The default implementation returns a disabled-tags instance.

Note that it is normal for branch to be a RemoteBranch when using tags on a RemoteBranch.

def network_name(self):
A simple byte string uniquely identifying this format for RPC calls.

MetaDir branch formats use their disk format string to identify the repository over the wire. All in one formats such as bzr < 0.8, and foreign formats like svn/git and hg should use some marker which is unique and immutable.

def open(self, controldir, name=None, _found=False, ignore_fallbacks=False, found_repository=None):
Return the branch object for controldir.
ParameterscontroldirA ControlDir that contains a branch.
nameName of colocated branch to open
_founda private parameter, do not use it. It is used to indicate if format probing has already be done.
ignore_fallbackswhen set, no fallback branches will be opened (if there are any). Default is to open fallbacks.
@classmethod
@deprecated_method(deprecated_in((2, 4, 0)))
def register_format(klass, format):
Register a metadir format.

See MetaDirBranchFormatFactory for the ability to register a format without loading the code the format needs until it is actually used.

@classmethod
@deprecated_method(deprecated_in((2, 4, 0)))
def set_default_format(klass, format):
Undocumented
def supports_set_append_revisions_only(self):
True if this format supports set_append_revisions_only.
def supports_stacking(self):
True if this format records a stacked-on branch.
def supports_leaving_lock(self):
True if this format supports leaving locks in place.
@classmethod
@deprecated_method(deprecated_in((2, 4, 0)))
def unregister_format(klass, format):
Undocumented
def __str__(self):
Undocumented
def supports_tags(self):
True if this format supports tags stored in the branch
def tags_are_versioned(self):
Whether the tag container for this branch versions tags.
def supports_tags_referencing_ghosts(self):
True if tags can reference ghost revisions.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.