~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_status.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-11 00:23:23 UTC
  • mfrom: (2070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061011002323-82ba88c293d7caff
[merge] bzr.dev 2070

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from StringIO import StringIO
19
19
 
20
 
from bzrlib.bzrdir import BzrDir
21
 
from bzrlib.status import show_pending_merges
22
 
from bzrlib.tests import TestCaseInTempDir
23
 
 
24
 
 
25
 
class TestStatus(TestCaseInTempDir):
 
20
from bzrlib.revisionspec import RevisionSpec
 
21
from bzrlib.status import show_pending_merges, show_tree_status
 
22
from bzrlib.tests import TestCaseWithTransport
 
23
 
 
24
 
 
25
class TestStatus(TestCaseWithTransport):
26
26
 
27
27
    def test_pending_none(self):
28
28
        # Test whether show_pending_merges works in a tree with no commits
29
 
        tree = BzrDir.create_standalone_workingtree('a')
 
29
        tree = self.make_branch_and_tree('a')
30
30
        tree.commit('empty commit')
31
 
        tree2 = BzrDir.create_standalone_workingtree('b')
32
 
        tree2.branch.fetch(tree.branch)
33
 
        tree2.set_pending_merges([tree.last_revision()])
 
31
        tree2 = self.make_branch_and_tree('b')
 
32
        # set a left most parent that is not a present commit
 
33
        tree2.add_parent_tree_id('some-ghost', allow_leftmost_as_ghost=True)
 
34
        # do a merge
 
35
        tree2.merge_from_branch(tree.branch)
34
36
        output = StringIO()
35
37
        show_pending_merges(tree2, output)
36
38
        self.assertContainsRe(output.getvalue(), 'empty commit')
 
39
 
 
40
    def tests_revision_to_revision(self):
 
41
        """doing a status between two revision trees should work."""
 
42
        tree = self.make_branch_and_tree('.')
 
43
        r1_id = tree.commit('one', allow_pointless=True)
 
44
        r2_id = tree.commit('two', allow_pointless=True)
 
45
        r2_tree = tree.branch.repository.revision_tree(r2_id)
 
46
        output = StringIO()
 
47
        show_tree_status(tree, to_file=output,
 
48
                     revision=[RevisionSpec.from_string("revid:%s" % r1_id),
 
49
                               RevisionSpec.from_string("revid:%s" % r2_id)])
 
50
        # return does not matter as long as it did not raise.