1823
class BzrBranchExperimental(BzrBranch5):
1824
"""Bzr experimental branch format
1827
- a revision-history file.
1829
- a lock dir guarding the branch itself
1830
- all of this stored in a branch/ subdirectory
1831
- works with shared repositories.
1832
- a tag dictionary in the branch
1834
This format is new in bzr 0.15, but shouldn't be used for real data,
1837
This class acts as it's own BranchFormat.
1840
_matchingbzrdir = bzrdir.BzrDirMetaFormat1()
1843
def get_format_string(cls):
1844
"""See BranchFormat.get_format_string()."""
1845
return "Bazaar-NG branch format experimental\n"
1848
def get_format_description(cls):
1849
"""See BranchFormat.get_format_description()."""
1850
return "Experimental branch format"
1853
def get_reference(cls, a_bzrdir):
1854
"""Get the target reference of the branch in a_bzrdir.
1856
format probing must have been completed before calling
1857
this method - it is assumed that the format of the branch
1858
in a_bzrdir is correct.
1860
:param a_bzrdir: The bzrdir to get the branch data from.
1861
:return: None if the branch is not a reference branch.
1866
def set_reference(self, a_bzrdir, to_branch):
1867
"""Set the target reference of the branch in a_bzrdir.
1869
format probing must have been completed before calling
1870
this method - it is assumed that the format of the branch
1871
in a_bzrdir is correct.
1873
:param a_bzrdir: The bzrdir to set the branch reference for.
1874
:param to_branch: branch that the checkout is to reference
1876
raise NotImplementedError(self.set_reference)
1879
def _initialize_control_files(cls, a_bzrdir, utf8_files, lock_filename,
1881
branch_transport = a_bzrdir.get_branch_transport(cls)
1882
control_files = lockable_files.LockableFiles(branch_transport,
1883
lock_filename, lock_class)
1884
control_files.create_lock()
1885
control_files.lock_write()
1887
for filename, content in utf8_files:
1888
control_files.put_utf8(filename, content)
1890
control_files.unlock()
1893
def initialize(cls, a_bzrdir):
1894
"""Create a branch of this format in a_bzrdir."""
1895
utf8_files = [('format', cls.get_format_string()),
1896
('revision-history', ''),
1897
('branch-name', ''),
1900
cls._initialize_control_files(a_bzrdir, utf8_files,
1901
'lock', lockdir.LockDir)
1902
return cls.open(a_bzrdir, _found=True)
1905
def open(cls, a_bzrdir, _found=False):
1906
"""Return the branch object for a_bzrdir
1908
_found is a private parameter, do not use it. It is used to indicate
1909
if format probing has already be done.
1912
format = BranchFormat.find_format(a_bzrdir)
1913
assert format.__class__ == cls
1914
transport = a_bzrdir.get_branch_transport(None)
1915
control_files = lockable_files.LockableFiles(transport, 'lock',
1917
return cls(_format=cls,
1918
_control_files=control_files,
1920
_repository=a_bzrdir.find_repository())
1923
def is_supported(cls):
1926
def _make_tags(self):
1927
return BasicTags(self)
1930
def supports_tags(cls):
1934
BranchFormat.register_format(BzrBranchExperimental)
1937
1823
class BzrBranch6(BzrBranch5):
1939
1825
@needs_read_lock