1
/// A repository format.
3
/// Formats provide four things:
4
/// * An initialization routine to construct repository data on disk.
5
/// * a optional format string which is used when the BzrDir supports
6
/// versioned children.
7
/// * an open routine which returns a Repository instance.
8
/// * A network name for referring to the format in smart server RPC
11
/// There is one and only one Format subclass for each on-disk format. But
12
/// there can be one Repository subclass that is used for several different
13
/// formats. The _format attribute on a Repository instance can be used to
14
/// determine the disk format.
16
/// Formats are placed in a registry by their format string for reference
17
/// during opening. These should be subclasses of RepositoryFormat for
20
/// Once a format is deprecated, just deprecate the initialize and open
21
/// methods on the format class. Do not deprecate the object, as the
22
/// object may be created even when a repository instance hasn't been
25
/// Common instance attributes:
26
/// _matchingcontroldir - the controldir format that the repository format was
27
/// originally written to work with. This can be used if manually
28
/// constructing a bzrdir and repository, or more commonly for test suite
30
pub trait RepositoryFormat {
31
fn get_format_description(&self) -> String;
33
/// Is this format supported?
35
/// Supported formats must be initializable and openable.
36
/// Unsupported formats may not support initialization or committing or
37
/// some other features depending on the reason for not being supported.
38
fn is_supported(&self) -> bool;
40
/// Is this format deprecated?
42
/// Deprecated formats may trigger a user-visible warning recommending
43
/// the user to upgrade. They are still fully supported.
44
fn is_deprecated(&self) -> bool;
46
/// A simple byte string uniquely identifying this format for RPC calls.
48
/// MetaDir repository formats use their disk format string to identify the
49
/// repository over the wire. All in one formats such as bzr < 0.8, and
50
/// foreign formats like svn/git and hg should use some marker which is
51
/// unique and immutable.
52
fn network_name(&self) -> Vec<u8>;