/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_status.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

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
19
18
 
20
 
from bzrlib import (
 
19
from .. import (
21
20
    config,
22
21
    status as _mod_status,
23
22
    )
24
 
from bzrlib.revisionspec import RevisionSpec
25
 
from bzrlib.status import show_pending_merges, show_tree_status
26
 
from bzrlib.tests import TestCaseWithTransport
 
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
27
29
 
28
30
 
29
31
class TestStatus(TestCaseWithTransport):
37
39
        tree2.add_parent_tree_id('some-ghost', allow_leftmost_as_ghost=True)
38
40
        # do a merge
39
41
        tree2.merge_from_branch(tree.branch)
40
 
        output = StringIO()
 
42
        output = BytesIO()
41
43
        tree2.lock_read()
42
44
        try:
43
45
            show_pending_merges(tree2, output)
61
63
 
62
64
    def test_multiple_pending(self):
63
65
        tree = self.make_multiple_pending_tree()
64
 
        output = StringIO()
 
66
        output = BytesIO()
65
67
        tree.lock_read()
66
68
        self.addCleanup(tree.unlock)
67
69
        show_pending_merges(tree, output)
74
76
 
75
77
    def test_multiple_pending_verbose(self):
76
78
        tree = self.make_multiple_pending_tree()
77
 
        output = StringIO()
 
79
        output = BytesIO()
78
80
        tree.lock_read()
79
81
        self.addCleanup(tree.unlock)
80
82
        show_pending_merges(tree, output, verbose=True)
93
95
        tree.add_parent_tree_id('a-ghost-revision')
94
96
        tree.lock_read()
95
97
        self.addCleanup(tree.unlock)
96
 
        output = StringIO()
 
98
        output = BytesIO()
97
99
        show_pending_merges(tree, output)
98
100
        self.assertEqualDiff(
99
101
            'pending merge tips: (use -v to see all merge revisions)\n'
113
115
        tree.merge_from_branch(tree2.branch)
114
116
        tree.lock_read()
115
117
        self.addCleanup(tree.unlock)
116
 
        output = StringIO()
 
118
        output = BytesIO()
117
119
        show_pending_merges(tree, output, verbose=True)
118
120
        self.assertEqualDiff('pending merges:\n'
119
121
                             '  Joe Foo 2007-12-04 another non-ghost\n'
128
130
        r1_id = tree.commit('one', allow_pointless=True)
129
131
        r2_id = tree.commit('two', allow_pointless=True)
130
132
        r2_tree = tree.branch.repository.revision_tree(r2_id)
131
 
        output = StringIO()
 
133
        output = BytesIO()
132
134
        show_tree_status(tree, to_file=output,
133
135
                     revision=[RevisionSpec.from_string("revid:%s" % r1_id),
134
136
                               RevisionSpec.from_string("revid:%s" % r2_id)])
161
163
        r1_id = tree.commit('one', allow_pointless=True)
162
164
        r2_id = tree.commit('two', allow_pointless=True)
163
165
        r2_tree = tree.branch.repository.revision_tree(r2_id)
164
 
        output = StringIO()
 
166
        output = BytesIO()
165
167
        show_tree_status(tree, to_file=output,
166
168
            revision=[RevisionSpec.from_string("revid:%s" % r1_id),
167
169
                RevisionSpec.from_string("revid:%s" % r2_id)])
184
186
        r1_id = tree.commit('one', allow_pointless=True)
185
187
        r2_id = tree.commit('two', allow_pointless=True)
186
188
        r2_tree = tree.branch.repository.revision_tree(r2_id)
187
 
        output = StringIO()
 
189
        output = BytesIO()
188
190
        show_tree_status(tree, to_file=output,
189
191
            revision=[RevisionSpec.from_string("revid:%s" % r1_id),
190
192
                RevisionSpec.from_string("revid:%s" % r2_id)])