/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/test_status.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
 
18
from StringIO import StringIO
18
19
 
19
 
from .. import (
 
20
from bzrlib import (
20
21
    config,
21
22
    status as _mod_status,
22
23
    )
23
 
from ..revisionspec import RevisionSpec
24
 
from ..sixish import (
25
 
    BytesIO,
26
 
    )
27
 
from ..status import show_pending_merges, show_tree_status
28
 
from . import TestCaseWithTransport
 
24
from bzrlib.revisionspec import RevisionSpec
 
25
from bzrlib.status import show_pending_merges, show_tree_status
 
26
from bzrlib.tests import TestCaseWithTransport
29
27
 
30
28
 
31
29
class TestStatus(TestCaseWithTransport):
39
37
        tree2.add_parent_tree_id('some-ghost', allow_leftmost_as_ghost=True)
40
38
        # do a merge
41
39
        tree2.merge_from_branch(tree.branch)
42
 
        output = BytesIO()
 
40
        output = StringIO()
43
41
        tree2.lock_read()
44
42
        try:
45
43
            show_pending_merges(tree2, output)
51
49
        config.GlobalStack().set('email', 'Joe Foo <joe@foo.com>')
52
50
        tree = self.make_branch_and_tree('a')
53
51
        tree.commit('commit 1', timestamp=1196796819, timezone=0)
54
 
        tree2 = tree.controldir.clone('b').open_workingtree()
 
52
        tree2 = tree.bzrdir.clone('b').open_workingtree()
55
53
        tree.commit('commit 2', timestamp=1196796819, timezone=0)
56
54
        tree2.commit('commit 2b', timestamp=1196796819, timezone=0)
57
 
        tree3 = tree2.controldir.clone('c').open_workingtree()
 
55
        tree3 = tree2.bzrdir.clone('c').open_workingtree()
58
56
        tree2.commit('commit 3b', timestamp=1196796819, timezone=0)
59
57
        tree3.commit('commit 3c', timestamp=1196796819, timezone=0)
60
58
        tree.merge_from_branch(tree2.branch)
63
61
 
64
62
    def test_multiple_pending(self):
65
63
        tree = self.make_multiple_pending_tree()
66
 
        output = BytesIO()
 
64
        output = StringIO()
67
65
        tree.lock_read()
68
66
        self.addCleanup(tree.unlock)
69
67
        show_pending_merges(tree, output)
76
74
 
77
75
    def test_multiple_pending_verbose(self):
78
76
        tree = self.make_multiple_pending_tree()
79
 
        output = BytesIO()
 
77
        output = StringIO()
80
78
        tree.lock_read()
81
79
        self.addCleanup(tree.unlock)
82
80
        show_pending_merges(tree, output, verbose=True)
95
93
        tree.add_parent_tree_id('a-ghost-revision')
96
94
        tree.lock_read()
97
95
        self.addCleanup(tree.unlock)
98
 
        output = BytesIO()
 
96
        output = StringIO()
99
97
        show_pending_merges(tree, output)
100
98
        self.assertEqualDiff(
101
99
            'pending merge tips: (use -v to see all merge revisions)\n'
107
105
        config.GlobalStack().set('email', 'Joe Foo <joe@foo.com>')
108
106
        tree = self.make_branch_and_tree('a')
109
107
        tree.commit('empty commit')
110
 
        tree2 = tree.controldir.clone('b').open_workingtree()
 
108
        tree2 = tree.bzrdir.clone('b').open_workingtree()
111
109
        tree2.commit('a non-ghost', timestamp=1196796819, timezone=0)
112
110
        tree2.add_parent_tree_id('a-ghost-revision')
113
111
        tree2.commit('commit with ghost', timestamp=1196796819, timezone=0)
115
113
        tree.merge_from_branch(tree2.branch)
116
114
        tree.lock_read()
117
115
        self.addCleanup(tree.unlock)
118
 
        output = BytesIO()
 
116
        output = StringIO()
119
117
        show_pending_merges(tree, output, verbose=True)
120
118
        self.assertEqualDiff('pending merges:\n'
121
119
                             '  Joe Foo 2007-12-04 another non-ghost\n'
130
128
        r1_id = tree.commit('one', allow_pointless=True)
131
129
        r2_id = tree.commit('two', allow_pointless=True)
132
130
        r2_tree = tree.branch.repository.revision_tree(r2_id)
133
 
        output = BytesIO()
 
131
        output = StringIO()
134
132
        show_tree_status(tree, to_file=output,
135
133
                     revision=[RevisionSpec.from_string("revid:%s" % r1_id),
136
134
                               RevisionSpec.from_string("revid:%s" % r2_id)])
163
161
        r1_id = tree.commit('one', allow_pointless=True)
164
162
        r2_id = tree.commit('two', allow_pointless=True)
165
163
        r2_tree = tree.branch.repository.revision_tree(r2_id)
166
 
        output = BytesIO()
 
164
        output = StringIO()
167
165
        show_tree_status(tree, to_file=output,
168
166
            revision=[RevisionSpec.from_string("revid:%s" % r1_id),
169
167
                RevisionSpec.from_string("revid:%s" % r2_id)])
186
184
        r1_id = tree.commit('one', allow_pointless=True)
187
185
        r2_id = tree.commit('two', allow_pointless=True)
188
186
        r2_tree = tree.branch.repository.revision_tree(r2_id)
189
 
        output = BytesIO()
 
187
        output = StringIO()
190
188
        show_tree_status(tree, to_file=output,
191
189
            revision=[RevisionSpec.from_string("revid:%s" % r1_id),
192
190
                RevisionSpec.from_string("revid:%s" % r2_id)])