~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Merge create_checkout_convenience update

Show diffs side-by-side

added added

removed removed

Lines of Context:
284
284
            except errors.NotLocalUrl:
285
285
                pass
286
286
        return result
287
 
 
288
 
    @staticmethod
289
 
    def create_checkout_convenience(to_location, source, revision_id=None,
290
 
                                    lightweight=False):
291
 
        """Create a checkout of a branch.
292
287
        
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
299
 
        """
300
 
        if lightweight:
301
 
            checkout = BzrDirMetaFormat1().initialize(to_location)
302
 
            bzrlib.branch.BranchReferenceFormat().initialize(checkout, source)
303
 
        else:
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)
312
 
 
313
 
    
314
288
    @staticmethod
315
289
    def create_repository(base, shared=False):
316
290
        """Create a new BzrDir and Repository at the url 'base'.