1831
class BzrBranchExperimental(BzrBranch5):
1832
"""Bzr experimental branch format
1835
- a revision-history file.
1837
- a lock dir guarding the branch itself
1838
- all of this stored in a branch/ subdirectory
1839
- works with shared repositories.
1840
- a tag dictionary in the branch
1842
This format is new in bzr 0.15, but shouldn't be used for real data,
1845
This class acts as it's own BranchFormat.
1848
_matchingbzrdir = bzrdir.BzrDirMetaFormat1()
1851
def get_format_string(cls):
1852
"""See BranchFormat.get_format_string()."""
1853
return "Bazaar-NG branch format experimental\n"
1856
def get_format_description(cls):
1857
"""See BranchFormat.get_format_description()."""
1858
return "Experimental branch format"
1861
def get_reference(cls, a_bzrdir):
1862
"""Get the target reference of the branch in a_bzrdir.
1864
format probing must have been completed before calling
1865
this method - it is assumed that the format of the branch
1866
in a_bzrdir is correct.
1868
:param a_bzrdir: The bzrdir to get the branch data from.
1869
:return: None if the branch is not a reference branch.
1874
def set_reference(self, a_bzrdir, to_branch):
1875
"""Set the target reference of the branch in a_bzrdir.
1877
format probing must have been completed before calling
1878
this method - it is assumed that the format of the branch
1879
in a_bzrdir is correct.
1881
:param a_bzrdir: The bzrdir to set the branch reference for.
1882
:param to_branch: branch that the checkout is to reference
1884
raise NotImplementedError(self.set_reference)
1887
def _initialize_control_files(cls, a_bzrdir, utf8_files, lock_filename,
1889
branch_transport = a_bzrdir.get_branch_transport(cls)
1890
control_files = lockable_files.LockableFiles(branch_transport,
1891
lock_filename, lock_class)
1892
control_files.create_lock()
1893
control_files.lock_write()
1895
for filename, content in utf8_files:
1896
control_files.put_utf8(filename, content)
1898
control_files.unlock()
1901
def initialize(cls, a_bzrdir):
1902
"""Create a branch of this format in a_bzrdir."""
1903
utf8_files = [('format', cls.get_format_string()),
1904
('revision-history', ''),
1905
('branch-name', ''),
1908
cls._initialize_control_files(a_bzrdir, utf8_files,
1909
'lock', lockdir.LockDir)
1910
return cls.open(a_bzrdir, _found=True)
1913
def open(cls, a_bzrdir, _found=False):
1914
"""Return the branch object for a_bzrdir
1916
_found is a private parameter, do not use it. It is used to indicate
1917
if format probing has already be done.
1920
format = BranchFormat.find_format(a_bzrdir)
1921
assert format.__class__ == cls
1922
transport = a_bzrdir.get_branch_transport(None)
1923
control_files = lockable_files.LockableFiles(transport, 'lock',
1925
return cls(_format=cls,
1926
_control_files=control_files,
1928
_repository=a_bzrdir.find_repository())
1931
def is_supported(cls):
1934
def _make_tags(self):
1935
return BasicTags(self)
1938
def supports_tags(cls):
1942
BranchFormat.register_format(BzrBranchExperimental)
1945
1827
class BzrBranch6(BzrBranch5):
1947
1829
@needs_read_lock