284
284
except errors.NotLocalUrl:
289
def create_checkout_convenience(to_location, source, revision_id=None,
291
"""Create a checkout of a branch.
293
:param to_location: The url to produce the checkout at
294
:param source: The branch to produce the checkout from
295
:param revision_id: The revision to check out
296
:param lighweight: If True, produce a lightweight checkout, othewise
297
produce a bound branch (heavyweight checkout)
298
:return: The tree of the created checkout
301
checkout = BzrDirMetaFormat1().initialize(to_location)
302
bzrlib.branch.BranchReferenceFormat().initialize(checkout, source)
304
checkout_branch = BzrDir.create_branch_convenience(
305
to_location, force_new_tree=False)
306
checkout = checkout_branch.bzrdir
307
checkout_branch.bind(source)
308
if revision_id is not None:
309
rh = checkout_branch.revision_history()
310
checkout_branch.set_revision_history(rh[:rh.index(revision_id) + 1])
311
return checkout.create_workingtree(revision_id)
315
289
def create_repository(base, shared=False):
316
290
"""Create a new BzrDir and Repository at the url 'base'.