/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-09 01:33:12 UTC
  • mfrom: (5710 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5718.
  • Revision ID: jelmer@samba.org-20110309013312-mgznp2euxhgkdsby
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
     - a branch-lock lock file [ to be shared with the bzrdir ]
50
50
    """
51
51
 
52
 
    def get_format_description(self):
53
 
        """See BranchFormat.get_format_description()."""
54
 
        return "Branch format 4"
55
 
 
56
 
    def _initialize_helper(self, a_bzrdir, utf8_files, name=None):
57
 
        """Initialize a branch in a bzrdir, with specified files
 
52
    def initialize(self, a_bzrdir, name=None, repository=None):
 
53
        """Create a branch of this format in a_bzrdir.
58
54
 
59
55
        :param a_bzrdir: The bzrdir to initialize the branch in
60
 
        :param utf8_files: The files to create as a list of
61
 
            (filename, content) tuples
62
56
        :param name: Name of colocated branch to create, if any
63
 
        :return: a branch in this format
 
57
        :param repository: Repository for this branch (unused)
64
58
        """
 
59
        if repository is not None:
 
60
            raise NotImplementedError(
 
61
                "initialize(repository=<not None>) on %r" % (self,))
 
62
        if not [isinstance(a_bzrdir._format, format) for format in
 
63
                self._compatible_bzrdirs]:
 
64
            raise errors.IncompatibleFormat(self, a_bzrdir._format)
 
65
        utf8_files = [('revision-history', ''),
 
66
                      ('branch-name', ''),
 
67
                      ]
65
68
        mutter('creating branch %r in %s', self, a_bzrdir.user_url)
66
69
        branch_transport = a_bzrdir.get_branch_transport(self, name=name)
67
70
        control_files = lockable_files.LockableFiles(branch_transport,
86
89
        self._run_post_branch_init_hooks(a_bzrdir, name, branch)
87
90
        return branch
88
91
 
89
 
    def initialize(self, a_bzrdir, name=None, repository=None):
90
 
        """Create a branch of this format in a_bzrdir."""
91
 
        if repository is not None:
92
 
            raise NotImplementedError(
93
 
                "initialize(repository=<not None>) on %r" % (self,))
94
 
        utf8_files = [('revision-history', ''),
95
 
                      ('branch-name', ''),
96
 
                      ]
97
 
        return self._initialize_helper(a_bzrdir, utf8_files, name=name)
98
 
 
99
92
    def __init__(self):
100
93
        super(BzrBranchFormat4, self).__init__()
101
 
        from bzrlib.plugins.weave_fmt.bzrdir import BzrDirFormat6
 
94
        from bzrlib.plugins.weave_fmt.bzrdir import (
 
95
            BzrDirFormat4, BzrDirFormat5, BzrDirFormat6,
 
96
            )
102
97
        self._matchingbzrdir = BzrDirFormat6()
 
98
        self._compatible_bzrdirs = [BzrDirFormat4, BzrDirFormat5,
 
99
            BzrDirFormat6]
103
100
 
104
101
    def network_name(self):
105
102
        """The network name for this format is the control dirs disk label."""
106
103
        return self._matchingbzrdir.get_format_string()
107
104
 
 
105
    def get_format_description(self):
 
106
        return "Branch format 4"
 
107
 
108
108
    def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False,
109
109
            found_repository=None):
110
110
        """See BranchFormat.open()."""