~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_uncommit.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
19
19
Note that uncommit currently is not a branch method; it should be.
20
20
"""
21
21
 
22
 
from bzrlib.branch import Branch
23
 
from bzrlib import errors
24
 
from bzrlib.tests.per_branch.test_branch import TestCaseWithBranch
25
 
from bzrlib.uncommit import uncommit
26
 
 
27
 
 
28
 
class TestUncommitHook(TestCaseWithBranch):
 
22
from bzrlib import (
 
23
    branch,
 
24
    errors,
 
25
    uncommit,
 
26
    )
 
27
from bzrlib.tests import per_branch
 
28
 
 
29
 
 
30
class TestUncommitHook(per_branch.TestCaseWithBranch):
29
31
 
30
32
    def setUp(self):
31
33
        self.hook_calls = []
32
 
        TestCaseWithBranch.setUp(self)
 
34
        super(TestUncommitHook, self).setUp()
33
35
 
34
36
    def capture_post_uncommit_hook(self, local, master, old_revno,
35
37
        old_revid, new_revno, new_revid):
53
55
        tree.add('')
54
56
        revid = tree.commit('a revision')
55
57
        tree.unlock()
56
 
        Branch.hooks.install_named_hook('post_uncommit',
 
58
        branch.Branch.hooks.install_named_hook('post_uncommit',
57
59
            self.capture_post_uncommit_hook, None)
58
 
        uncommit(tree.branch)
 
60
        uncommit.uncommit(tree.branch)
59
61
        # with nothing left we should still get a notification, and
60
62
        # have the branch locked at notification time.
61
63
        self.assertEqual([
76
78
        tree.add('')
77
79
        revid = tree.commit('a revision')
78
80
        tree.unlock()
79
 
        Branch.hooks.install_named_hook('post_uncommit',
80
 
            self.capture_post_uncommit_hook, None)
81
 
        uncommit(tree.branch)
 
81
        branch.Branch.hooks.install_named_hook(
 
82
            'post_uncommit', self.capture_post_uncommit_hook, None)
 
83
        uncommit.uncommit(tree.branch)
82
84
        # with nothing left we should still get a notification, and
83
85
        # have the branch locked at notification time.
84
86
        self.assertEqual([
95
97
        revid2 = tree.commit('second revision')
96
98
        revid3 = tree.commit('third revision')
97
99
        tree.unlock()
98
 
        Branch.hooks.install_named_hook('post_uncommit',
99
 
            self.capture_post_uncommit_hook, None)
100
 
        uncommit(tree.branch, revno=2)
 
100
        branch.Branch.hooks.install_named_hook(
 
101
            'post_uncommit', self.capture_post_uncommit_hook, None)
 
102
        uncommit.uncommit(tree.branch, revno=2)
101
103
        # having uncommitted from up the branch, we should get the
102
104
        # before and after revnos and revids correctly.
103
105
        self.assertEqual([