def test_shared_repos(self): self.make_repository('a', shared=True) ControlDir.create_branch_convenience('a/branch1') b = ControlDir.create_branch_convenience('a/branch2') b.create_checkout(lightweight=True, to_location='b') out, err = self.run_bzr('branches b') self.assertEqual(out, " branch1\n" "* branch2\n")
def test_post_pull_bound_branch(self): # pulling to a bound branch should pass in the master branch to the # hook, allowing the correct number of emails to be sent, while still # allowing hooks that want to modify the target to do so to both # instances. target = self.make_to_branch('target') local = self.make_from_branch('local') try: local.bind(target) except errors.UpgradeRequired: # We can't bind this format to itself- typically it is the local # branch that doesn't support binding. As of May 2007 # remotebranches can't be bound. Let's instead make a new local # branch of the default type, which does allow binding. # See https://bugs.launchpad.net/bzr/+bug/112020 local = ControlDir.create_branch_convenience('local2') local.bind(target) source = self.make_from_branch('source') Branch.hooks.install_named_hook('post_pull', self.capture_post_pull_hook, None) local.pull(source) # with nothing there we should still get a notification, and # have both branches locked at the notification time. self.assertEqual([ ('post_pull', source, local.base, target.base, 0, NULL_REVISION, 0, NULL_REVISION, True, True, True) ], self.hook_calls)
def _create_heavyweight_checkout(self, to_location, revision_id=None, hardlink=False): """Create a new heavyweight checkout of this branch. :param to_location: URL of location to create the new checkout in. :param revision_id: Revision that should be the tip of the checkout. :param hardlink: Whether to hardlink :return: WorkingTree object of checkout. """ checkout_branch = ControlDir.create_branch_convenience( to_location, force_new_tree=False, format=self._get_checkout_format(lightweight=False)) checkout = checkout_branch.controldir checkout_branch.bind(self) # pull up to the specified revision_id to set the initial # branch tip correctly, and seed it with history. checkout_branch.pull(self, stop_revision=revision_id) return checkout.create_workingtree(revision_id, hardlink=hardlink)
def test_not_for_writing(self): self.make_svn_branch_and_tree("d", "dc") x = ControlDir.create_branch_convenience("dc/foo") self.assertFalse(hasattr(x.repository, "uuid"))