1645
1645
for hook in hooks:
1648
def _initialize_helper(self, a_bzrdir, utf8_files, name=None,
1650
"""Initialize a branch in a bzrdir, with specified files
1652
:param a_bzrdir: The bzrdir to initialize the branch in
1653
:param utf8_files: The files to create as a list of
1654
(filename, content) tuples
1655
:param name: Name of colocated branch to create, if any
1656
:return: a branch in this format
1658
mutter('creating branch %r in %s', self, a_bzrdir.user_url)
1659
branch_transport = a_bzrdir.get_branch_transport(self, name=name)
1660
control_files = lockable_files.LockableFiles(branch_transport,
1661
'lock', lockdir.LockDir)
1662
control_files.create_lock()
1663
control_files.lock_write()
1665
utf8_files += [('format', self.get_format_string())]
1666
for (filename, content) in utf8_files:
1667
branch_transport.put_bytes(
1669
mode=a_bzrdir._get_file_mode())
1671
control_files.unlock()
1672
branch = self.open(a_bzrdir, name, _found=True,
1673
found_repository=repository)
1674
self._run_post_branch_init_hooks(a_bzrdir, name, branch)
1677
1648
def initialize(self, a_bzrdir, name=None, repository=None):
1678
1649
"""Create a branch of this format in a_bzrdir.
2010
1981
"""What class to instantiate on open calls."""
2011
1982
raise NotImplementedError(self._branch_class)
1984
def _initialize_helper(self, a_bzrdir, utf8_files, name=None,
1986
"""Initialize a branch in a bzrdir, with specified files
1988
:param a_bzrdir: The bzrdir to initialize the branch in
1989
:param utf8_files: The files to create as a list of
1990
(filename, content) tuples
1991
:param name: Name of colocated branch to create, if any
1992
:return: a branch in this format
1994
mutter('creating branch %r in %s', self, a_bzrdir.user_url)
1995
branch_transport = a_bzrdir.get_branch_transport(self, name=name)
1996
control_files = lockable_files.LockableFiles(branch_transport,
1997
'lock', lockdir.LockDir)
1998
control_files.create_lock()
1999
control_files.lock_write()
2001
utf8_files += [('format', self.get_format_string())]
2002
for (filename, content) in utf8_files:
2003
branch_transport.put_bytes(
2005
mode=a_bzrdir._get_file_mode())
2007
control_files.unlock()
2008
branch = self.open(a_bzrdir, name, _found=True,
2009
found_repository=repository)
2010
self._run_post_branch_init_hooks(a_bzrdir, name, branch)
2013
2013
def network_name(self):
2014
2014
"""A simple byte string uniquely identifying this format for RPC calls.
2166
2166
supports_reference_locations = True
2169
class BzrBranchFormat7(BzrBranchFormat8):
2169
class BzrBranchFormat7(BranchFormatMetadir):
2170
2170
"""Branch format with last-revision, tags, and a stacked location pointer.
2172
2172
The stacked location pointer is passed down to the repository and requires