1827
class BzrBranchExperimental(BzrBranch5):
1828
"""Bzr experimental branch format
1831
- a revision-history file.
1833
- a lock dir guarding the branch itself
1834
- all of this stored in a branch/ subdirectory
1835
- works with shared repositories.
1836
- a tag dictionary in the branch
1838
This format is new in bzr 0.15, but shouldn't be used for real data,
1841
This class acts as it's own BranchFormat.
1844
_matchingbzrdir = bzrdir.BzrDirMetaFormat1()
1847
def get_format_string(cls):
1848
"""See BranchFormat.get_format_string()."""
1849
return "Bazaar-NG branch format experimental\n"
1852
def get_format_description(cls):
1853
"""See BranchFormat.get_format_description()."""
1854
return "Experimental branch format"
1857
def get_reference(cls, a_bzrdir):
1858
"""Get the target reference of the branch in a_bzrdir.
1860
format probing must have been completed before calling
1861
this method - it is assumed that the format of the branch
1862
in a_bzrdir is correct.
1864
:param a_bzrdir: The bzrdir to get the branch data from.
1865
:return: None if the branch is not a reference branch.
1870
def set_reference(self, a_bzrdir, to_branch):
1871
"""Set the target reference of the branch in a_bzrdir.
1873
format probing must have been completed before calling
1874
this method - it is assumed that the format of the branch
1875
in a_bzrdir is correct.
1877
:param a_bzrdir: The bzrdir to set the branch reference for.
1878
:param to_branch: branch that the checkout is to reference
1880
raise NotImplementedError(self.set_reference)
1883
def _initialize_control_files(cls, a_bzrdir, utf8_files, lock_filename,
1885
branch_transport = a_bzrdir.get_branch_transport(cls)
1886
control_files = lockable_files.LockableFiles(branch_transport,
1887
lock_filename, lock_class)
1888
control_files.create_lock()
1889
control_files.lock_write()
1891
for filename, content in utf8_files:
1892
control_files.put_utf8(filename, content)
1894
control_files.unlock()
1897
def initialize(cls, a_bzrdir):
1898
"""Create a branch of this format in a_bzrdir."""
1899
utf8_files = [('format', cls.get_format_string()),
1900
('revision-history', ''),
1901
('branch-name', ''),
1904
cls._initialize_control_files(a_bzrdir, utf8_files,
1905
'lock', lockdir.LockDir)
1906
return cls.open(a_bzrdir, _found=True)
1909
def open(cls, a_bzrdir, _found=False):
1910
"""Return the branch object for a_bzrdir
1912
_found is a private parameter, do not use it. It is used to indicate
1913
if format probing has already be done.
1916
format = BranchFormat.find_format(a_bzrdir)
1917
assert format.__class__ == cls
1918
transport = a_bzrdir.get_branch_transport(None)
1919
control_files = lockable_files.LockableFiles(transport, 'lock',
1921
return cls(_format=cls,
1922
_control_files=control_files,
1924
_repository=a_bzrdir.find_repository())
1927
def is_supported(cls):
1930
def _make_tags(self):
1931
return BasicTags(self)
1934
def supports_tags(cls):
1938
BranchFormat.register_format(BzrBranchExperimental)
1941
1827
class BzrBranch6(BzrBranch5):
1943
1829
@needs_read_lock