18
18
from StringIO import StringIO
20
from bzrlib.revisionspec import RevisionSpec
21
from bzrlib.status import show_pending_merges, show_tree_status
22
from bzrlib.tests import TestCaseWithTransport
25
class TestStatus(TestCaseWithTransport):
20
from bzrlib.bzrdir import BzrDir
21
from bzrlib.status import show_pending_merges
22
from bzrlib.tests import TestCaseInTempDir
25
class TestStatus(TestCaseInTempDir):
27
27
def test_pending_none(self):
28
28
# Test whether show_pending_merges works in a tree with no commits
29
tree = self.make_branch_and_tree('a')
29
tree = BzrDir.create_standalone_workingtree('a')
30
30
tree.commit('empty commit')
31
tree2 = self.make_branch_and_tree('b')
31
tree2 = BzrDir.create_standalone_workingtree('b')
32
32
tree2.branch.fetch(tree.branch)
33
33
tree2.set_pending_merges([tree.last_revision()])
34
34
output = StringIO()
35
35
show_pending_merges(tree2, output)
36
36
self.assertContainsRe(output.getvalue(), 'empty commit')
38
def tests_revision_to_revision(self):
39
"""doing a status between two revision trees should work."""
40
tree = self.make_branch_and_tree('.')
41
r1_id = tree.commit('one', allow_pointless=True)
42
r2_id = tree.commit('two', allow_pointless=True)
43
r2_tree = tree.branch.repository.revision_tree(r2_id)
45
show_tree_status(tree, to_file=output, revision=[RevisionSpec("revid:%s" % r1_id), RevisionSpec("revid:%s" % r2_id)])
46
# return does not matter as long as it did not raise.