/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

  • Committer: Jelmer Vernooij
  • Date: 2009-03-27 02:50:58 UTC
  • mto: (0.200.305 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090327025058-310jmu8b3wklghoc
Support lightweight checkouts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    repository,
29
29
    revision,
30
30
    tag,
 
31
    transport,
31
32
    )
32
33
from bzrlib.decorators import (
33
34
    needs_read_lock,
42
43
from bzrlib.plugins.git.foreign import (
43
44
    ForeignBranch,
44
45
    )
45
 
from bzrlib.plugins.git.errors import (
46
 
    LightWeightCheckoutsNotSupported,
47
 
    )
48
46
 
49
47
 
50
48
class LocalGitTagDict(tag.BasicTags):
169
167
            return revision.NULL_REVISION
170
168
        return self.mapping.revision_id_foreign_to_bzr(self.head)
171
169
 
 
170
    def _get_checkout_format(self):
 
171
        """Return the most suitable metadir for a checkout of this branch.
 
172
        Weaves are used if this branch's repository uses weaves.
 
173
        """
 
174
        format = self.repository.bzrdir.checkout_metadir()
 
175
        format.set_branch_format(self._format)
 
176
        return format
 
177
 
172
178
    def create_checkout(self, to_location, revision_id=None, lightweight=False,
173
179
        accelerator_tree=None, hardlink=False):
174
180
        if lightweight:
175
 
            raise LightWeightCheckoutsNotSupported()
176
 
        return self._create_heavyweight_checkout(to_location, revision_id,
 
181
            t = transport.get_transport(to_location)
 
182
            t.ensure_base()
 
183
            format = self._get_checkout_format()
 
184
            checkout = format.initialize_on_transport(t)
 
185
            from_branch = branch.BranchReferenceFormat().initialize(checkout, 
 
186
                self)
 
187
            tree = checkout.create_workingtree(revision_id,
 
188
                from_branch=from_branch, hardlink=hardlink)
 
189
            return tree
 
190
        else:
 
191
            return self._create_heavyweight_checkout(to_location, revision_id,
177
192
            hardlink)
178
193
 
179
194
    def _create_heavyweight_checkout(self, to_location, revision_id=None,