~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-05 14:47:30 UTC
  • mto: (5757.7.2 knitpackrepo-6)
  • mto: This revision was merged to the branch mainline in revision 5771.
  • Revision ID: jelmer@samba.org-20110405144730-uq6jmlblh97plv20
Add separate file for knit pack repository formats.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        urlutils,
43
43
        )
44
44
from bzrlib.config import BranchConfig, TransportConfig
45
 
from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack5RichRoot
 
45
from bzrlib.repofmt.knitpack_repo import RepositoryFormatKnitPack5RichRoot
46
46
from bzrlib.tag import (
47
47
    BasicTags,
48
48
    DisabledTags,
1645
1645
        for hook in hooks:
1646
1646
            hook(params)
1647
1647
 
1648
 
    def _initialize_helper(self, a_bzrdir, utf8_files, name=None,
1649
 
                           repository=None):
1650
 
        """Initialize a branch in a bzrdir, with specified files
1651
 
 
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
1657
 
        """
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()
1664
 
        try:
1665
 
            utf8_files += [('format', self.get_format_string())]
1666
 
            for (filename, content) in utf8_files:
1667
 
                branch_transport.put_bytes(
1668
 
                    filename, content,
1669
 
                    mode=a_bzrdir._get_file_mode())
1670
 
        finally:
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)
1675
 
        return branch
1676
 
 
1677
1648
    def initialize(self, a_bzrdir, name=None, repository=None):
1678
1649
        """Create a branch of this format in a_bzrdir.
1679
1650
        
2010
1981
        """What class to instantiate on open calls."""
2011
1982
        raise NotImplementedError(self._branch_class)
2012
1983
 
 
1984
    def _initialize_helper(self, a_bzrdir, utf8_files, name=None,
 
1985
                           repository=None):
 
1986
        """Initialize a branch in a bzrdir, with specified files
 
1987
 
 
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
 
1993
        """
 
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()
 
2000
        try:
 
2001
            utf8_files += [('format', self.get_format_string())]
 
2002
            for (filename, content) in utf8_files:
 
2003
                branch_transport.put_bytes(
 
2004
                    filename, content,
 
2005
                    mode=a_bzrdir._get_file_mode())
 
2006
        finally:
 
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)
 
2011
        return branch
 
2012
 
2013
2013
    def network_name(self):
2014
2014
        """A simple byte string uniquely identifying this format for RPC calls.
2015
2015
 
2166
2166
    supports_reference_locations = True
2167
2167
 
2168
2168
 
2169
 
class BzrBranchFormat7(BzrBranchFormat8):
 
2169
class BzrBranchFormat7(BranchFormatMetadir):
2170
2170
    """Branch format with last-revision, tags, and a stacked location pointer.
2171
2171
 
2172
2172
    The stacked location pointer is passed down to the repository and requires
2197
2197
    def supports_set_append_revisions_only(self):
2198
2198
        return True
2199
2199
 
 
2200
    def supports_stacking(self):
 
2201
        return True
 
2202
 
2200
2203
    supports_reference_locations = False
2201
2204
 
2202
2205