/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_switch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-04-22 17:08:27 UTC
  • mfrom: (5107.3.8 new_branch_and_repo_hooks)
  • Revision ID: pqm@pqm.ubuntu.com-20100422170827-h0bb41yq5nkosu6t
(vila) Add 'post_repo_init', 'post_branch_init' and 'post_switch' hooks. (Marco Pantaleoni)

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
        self.run_bzr('switch -b foo:branch2', working_dir='tree')
226
226
        tree = WorkingTree.open('tree')
227
227
        self.assertEndsWith(tree.branch.base, 'foo-branch2/')
 
228
 
 
229
    def test_switch_with_post_switch_hook(self):
 
230
        from bzrlib import branch as _mod_branch
 
231
        calls = []
 
232
        _mod_branch.Branch.hooks.install_named_hook('post_switch',
 
233
            calls.append, None)
 
234
        self.make_branch_and_tree('branch')
 
235
        self.run_bzr('branch branch branch2')
 
236
        self.run_bzr('checkout branch checkout')
 
237
        os.chdir('checkout')
 
238
        self.assertLength(0, calls)
 
239
        out, err = self.run_bzr('switch ../branch2')
 
240
        self.assertLength(1, calls)
 
241
 
 
242
    def test_switch_lightweight_co_with_post_switch_hook(self):
 
243
        from bzrlib import branch as _mod_branch
 
244
        calls = []
 
245
        _mod_branch.Branch.hooks.install_named_hook('post_switch',
 
246
            calls.append, None)
 
247
        self.make_branch_and_tree('branch')
 
248
        self.run_bzr('branch branch branch2')
 
249
        self.run_bzr('checkout --lightweight branch checkout')
 
250
        os.chdir('checkout')
 
251
        self.assertLength(0, calls)
 
252
        out, err = self.run_bzr('switch ../branch2')
 
253
        self.assertLength(1, calls)