Esempio n. 1
0
 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)
Esempio n. 2
0
 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)