~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-02 10:10:15 UTC
  • mfrom: (4723.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20091002101015-hed4j97ksfqyu4mp
(vila) (trivial) Cleanup some dpush related tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import os
22
22
 
23
 
from bzrlib.branch import (
24
 
    Branch,
25
 
    InterBranch,
26
 
    )
27
 
from bzrlib.bzrdir import (
28
 
    BzrDirFormat,
29
 
    )
30
 
from bzrlib.foreign import (
31
 
    ForeignBranch,
32
 
    ForeignRepository,
33
 
    )
34
 
from bzrlib.repository import (
35
 
    Repository,
36
 
    )
37
 
from bzrlib.tests.blackbox import (
38
 
    ExternalBase,
 
23
from bzrlib import (
 
24
    branch,
 
25
    bzrdir,
 
26
    foreign,
 
27
    tests,
39
28
    )
40
29
from bzrlib.tests.test_foreign import (
41
30
    DummyForeignVcsDirFormat,
42
31
    InterToDummyVcsBranch,
43
32
    )
44
 
 
45
 
 
46
 
class TestDpush(ExternalBase):
 
33
from bzrlib.tests import (
 
34
    blackbox,
 
35
    test_foreign,
 
36
    )
 
37
 
 
38
class TestDpush(blackbox.ExternalBase):
47
39
 
48
40
    def setUp(self):
49
 
        BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
50
 
        InterBranch.register_optimiser(InterToDummyVcsBranch)
 
41
        bzrdir.BzrDirFormat.register_control_format(
 
42
            test_foreign.DummyForeignVcsDirFormat)
 
43
        branch.InterBranch.register_optimiser(
 
44
            test_foreign.InterToDummyVcsBranch)
51
45
        self.addCleanup(self.unregister_format)
52
46
        super(TestDpush, self).setUp()
53
47
 
54
48
    def unregister_format(self):
55
49
        try:
56
 
            BzrDirFormat.unregister_control_format(DummyForeignVcsDirFormat)
 
50
            bzrdir.BzrDirFormat.unregister_control_format(
 
51
                test_foreign.DummyForeignVcsDirFormat)
57
52
        except ValueError:
58
53
            pass
59
 
        InterBranch.unregister_optimiser(InterToDummyVcsBranch)
 
54
        branch.InterBranch.unregister_optimiser(
 
55
            test_foreign.InterToDummyVcsBranch)
60
56
 
61
57
    def make_dummy_builder(self, relpath):
62
 
        builder = self.make_branch_builder(relpath, 
63
 
                format=DummyForeignVcsDirFormat())
64
 
        builder.build_snapshot('revid', None, 
 
58
        builder = self.make_branch_builder(
 
59
            relpath, format=test_foreign.DummyForeignVcsDirFormat())
 
60
        builder.build_snapshot('revid', None,
65
61
            [('add', ('', 'TREE_ROOT', 'directory', None)),
66
62
             ('add', ('foo', 'fooid', 'file', 'bar'))])
67
63
        return builder
85
81
        self.check_output("", "status dc")
86
82
 
87
83
    def test_dpush_new(self):
88
 
        branch = self.make_dummy_builder('d').get_branch()
 
84
        b = self.make_dummy_builder('d').get_branch()
89
85
 
90
 
        dc = branch.bzrdir.sprout('dc', force_new_repo=True)
 
86
        dc = b.bzrdir.sprout('dc', force_new_repo=True)
91
87
        self.build_tree_contents([("dc/foofile", "blaaaa")])
92
88
        dc_tree = dc.open_workingtree()
93
89
        dc_tree.add("foofile")
98
94
        self.check_output("", "status dc")
99
95
 
100
96
    def test_dpush_wt_diff(self):
101
 
        branch = self.make_dummy_builder('d').get_branch()
 
97
        b = self.make_dummy_builder('d').get_branch()
102
98
 
103
 
        dc = branch.bzrdir.sprout('dc', force_new_repo=True)
 
99
        dc = b.bzrdir.sprout('dc', force_new_repo=True)
104
100
        self.build_tree_contents([("dc/foofile", "blaaaa")])
105
101
        dc_tree = dc.open_workingtree()
106
102
        dc_tree.add("foofile")
114
110
    def test_diverged(self):
115
111
        builder = self.make_dummy_builder('d')
116
112
 
117
 
        branch = builder.get_branch()
 
113
        b = builder.get_branch()
118
114
 
119
 
        dc = branch.bzrdir.sprout('dc', force_new_repo=True)
 
115
        dc = b.bzrdir.sprout('dc', force_new_repo=True)
120
116
        dc_tree = dc.open_workingtree()
121
117
 
122
118
        self.build_tree_contents([("dc/foo", "bar")])