/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 branch.py

properly error out about not support lightweight checkouts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.trace import mutter
27
27
 
28
28
from bzrlib.plugins.git.foreign import ForeignBranch
 
29
from bzrlib.plugins.git.errors import LightWeightCheckoutsNotSupported
29
30
 
30
31
from dulwich.objects import (
31
32
        Commit,
123
124
            return revision.NULL_REVISION
124
125
        return self.mapping.revision_id_foreign_to_bzr(self.head)
125
126
 
 
127
    def create_checkout(self, to_location, revision_id=None, 
 
128
                        lightweight=False, accelerator_tree=None, hardlink=False):
 
129
        if lightweight:
 
130
            raise LightWeightCheckoutsNotSupported()
 
131
        return self._create_heavyweight_checkout(to_location, revision_id, hardlink)
 
132
 
 
133
    def _create_heavyweight_checkout(self, to_location, revision_id=None, 
 
134
                                     hardlink=False):
 
135
        """Create a new heavyweight checkout of this branch.
 
136
 
 
137
        :param to_location: URL of location to create the new checkout in.
 
138
        :param revision_id: Revision that should be the tip of the checkout.
 
139
        :param hardlink: Whether to hardlink
 
140
        :return: WorkingTree object of checkout.
 
141
        """
 
142
        checkout_branch = BzrDir.create_branch_convenience(
 
143
            to_location, force_new_tree=False, format=get_rich_root_format())
 
144
        checkout = checkout_branch.bzrdir
 
145
        checkout_branch.bind(self)
 
146
        # pull up to the specified revision_id to set the initial 
 
147
        # branch tip correctly, and seed it with history.
 
148
        checkout_branch.pull(self, stop_revision=revision_id)
 
149
        return checkout.create_workingtree(revision_id, hardlink=hardlink)
 
150
 
126
151
    def _make_tags(self):
127
152
        return GitTagDict(self)
128
153