~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/teststatus.py

- constraints on revprops
- tests for this

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib.selftest import TestCaseInTempDir
25
25
from bzrlib.revisionspec import RevisionSpec
26
 
from bzrlib.merge import merge
27
 
from cStringIO import StringIO
28
 
from bzrlib.status import show_status
29
 
from bzrlib.branch import Branch
30
 
from os import mkdir
31
 
from bzrlib.clone import copy_branch
32
26
 
33
27
class BranchStatus(TestCaseInTempDir):
34
28
    
60
54
 
61
55
    def test_branch_status_revisions(self):
62
56
        """Tests branch status with revisions"""
 
57
        from cStringIO import StringIO
 
58
        from bzrlib.status import show_status
 
59
        from bzrlib.branch import Branch
63
60
        
64
61
        b = Branch.initialize('.')
65
62
 
96
93
                           '  bye.c\n',
97
94
                           '  hello.c\n'])
98
95
 
99
 
    def status_string(self, branch):
100
 
        tof = StringIO()
101
 
        show_status(branch, to_file=tof)
102
 
        tof.seek(0)
103
 
        return tof.getvalue()
104
 
 
105
 
    def test_pending(self):
106
 
        """Pending merges display works"""
107
 
        mkdir("./branch")
108
 
        b = Branch.initialize('./branch')
109
 
        b.commit("Empty commit 1")
110
 
        b_2 = copy_branch(b, './copy')
111
 
        b.commit("Empty commit 2")
112
 
        merge(["./branch", -1], [None, None], this_dir = './copy')
113
 
        message = self.status_string(b_2)
114
 
        self.assert_(message.startswith("pending merges:\n"))
115
 
        self.assert_(message.endswith("Empty commit 2\n")) 
116
 
        b_2.commit("merged")
117
 
        # must be long to make sure we see elipsis at the end
118
 
        b.commit("Empty commit 3 blah blah blah blah blah blah blah blah blah"
119
 
                 " blah blah blah blah blah blah bleh")
120
 
        merge(["./branch", -1], [None, None], this_dir = './copy')
121
 
        message = self.status_string(b_2)
122
 
        self.assert_(message.startswith("pending merges:\n"))
123
 
        self.assert_("Empty commit 3" in message)
124
 
        self.assert_(message.endswith("...\n")) 
125
 
 
126
96
    def test_branch_status_specific_files(self): 
127
97
        """Tests branch status with given specific files"""
128
98
        from cStringIO import StringIO