~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-06-18 04:43:13 UTC
  • mto: This revision was merged to the branch mainline in revision 1794.
  • Revision ID: john@arbash-meinel.com-20060618044313-08d3915d095cb28b
Remove scope name for now, still log it, in case we need it for demandload.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Development Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
 
18
18
from StringIO import StringIO
19
19
 
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):
 
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):
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 = 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')
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)
 
31
        tree2 = BzrDir.create_standalone_workingtree('b')
 
32
        tree2.branch.fetch(tree.branch)
 
33
        tree2.set_pending_merges([tree.last_revision()])
36
34
        output = StringIO()
37
35
        show_pending_merges(tree2, output)
38
36
        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.