~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Patch Queue Manager
  • Date: 2012-01-23 15:31:35 UTC
  • mfrom: (6443.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20120123153135-8v3r3z1lx055vmpl
(jelmer) Merge the 2.5 series branch. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1457
1457
        t = transport.get_transport(to_location)
1458
1458
        t.ensure_base()
1459
1459
        format = self._get_checkout_format(lightweight=lightweight)
 
1460
        try:
 
1461
            checkout = format.initialize_on_transport(t)
 
1462
        except errors.AlreadyControlDirError:
 
1463
            # It's fine if the control directory already exists,
 
1464
            # as long as there is no existing branch and working tree.
 
1465
            checkout = controldir.ControlDir.open_from_transport(t)
 
1466
            try:
 
1467
                checkout.open_branch()
 
1468
            except errors.NotBranchError:
 
1469
                pass
 
1470
            else:
 
1471
                raise errors.AlreadyControlDirError(t.base)
 
1472
 
1460
1473
        if lightweight:
1461
 
            checkout = format.initialize_on_transport(t)
1462
 
            from_branch = BranchReferenceFormat().initialize(checkout, 
1463
 
                target_branch=self)
 
1474
            from_branch = checkout.set_branch_reference(target_branch=self)
1464
1475
        else:
1465
 
            checkout_branch = controldir.ControlDir.create_branch_convenience(
1466
 
                to_location, force_new_tree=False, format=format)
1467
 
            checkout = checkout_branch.bzrdir
 
1476
            policy = checkout.determine_repository_policy()
 
1477
            repo = policy.acquire_repository()[0]
 
1478
            checkout_branch = checkout.create_branch()
1468
1479
            checkout_branch.bind(self)
1469
1480
            # pull up to the specified revision_id to set the initial
1470
1481
            # branch tip correctly, and seed it with history.
1471
1482
            checkout_branch.pull(self, stop_revision=revision_id)
1472
 
            from_branch=None
 
1483
            from_branch = None
1473
1484
        tree = checkout.create_workingtree(revision_id,
1474
1485
                                           from_branch=from_branch,
1475
1486
                                           accelerator_tree=accelerator_tree,