~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/teststatus.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-29 20:34:25 UTC
  • mfrom: (1185.11.24)
  • mto: (1393.1.12)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050929203425-7fc2ea87f449dfe8
Merged in split-storage-2 branch. Need to cleanup a little bit more still.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
"""
22
22
 
23
23
 
24
 
from bzrlib.selftest import InTempDir
 
24
from bzrlib.selftest import TestCaseInTempDir
 
25
from bzrlib.revisionspec import RevisionSpec
25
26
 
26
 
class BranchStatus(InTempDir):
27
 
    def runTest(self): 
 
27
class BranchStatus(TestCaseInTempDir):
 
28
    
 
29
    def test_branch_status(self): 
28
30
        """Basic 'bzr mkdir' operation"""
29
31
        from cStringIO import StringIO
30
32
        from bzrlib.status import show_status
31
33
        from bzrlib.branch import Branch
32
34
        
33
 
        b = Branch('.', init=True)
 
35
        b = Branch.initialize('.')
34
36
 
35
37
        # status with nothing
36
38
        tof = StringIO()
39
41
 
40
42
        tof = StringIO()
41
43
        self.build_tree(['hello.c', 'bye.c'])
 
44
        b.add_pending_merge('pending@pending-0-0')
42
45
        show_status(b, to_file=tof)
43
46
        tof.seek(0)
44
47
        self.assertEquals(tof.readlines(),
45
48
                          ['unknown:\n',
46
49
                           '  bye.c\n',
47
50
                           '  hello.c\n',
 
51
                           'pending merges:\n',
 
52
                           '  pending@pending-0-0\n'
48
53
                           ])
49
54
 
 
55
    def test_branch_status_revisions(self):
 
56
        """Tests branch status with revisions"""
 
57
        from cStringIO import StringIO
 
58
        from bzrlib.status import show_status
 
59
        from bzrlib.branch import Branch
 
60
        
 
61
        b = Branch.initialize('.')
 
62
 
 
63
        tof = StringIO()
 
64
        self.build_tree(['hello.c', 'bye.c'])
 
65
        b.add('hello.c')
 
66
        b.add('bye.c')
 
67
        b.commit('Test message')
 
68
 
 
69
        tof = StringIO()
 
70
        revs =[]
 
71
        revs.append(RevisionSpec(0))
 
72
        
 
73
        show_status(b, to_file=tof, revision=revs)
 
74
        
 
75
        tof.seek(0)
 
76
        self.assertEquals(tof.readlines(),
 
77
                          ['added:\n',
 
78
                           '  bye.c\n',
 
79
                           '  hello.c\n'])
 
80
 
 
81
        self.build_tree(['more.c'])
 
82
        b.add('more.c')
 
83
        b.commit('Another test message')
 
84
        
 
85
        tof = StringIO()
 
86
        revs.append(RevisionSpec(1))
 
87
        
 
88
        show_status(b, to_file=tof, revision=revs)
 
89
        
 
90
        tof.seek(0)
 
91
        self.assertEquals(tof.readlines(),
 
92
                          ['added:\n',
 
93
                           '  bye.c\n',
 
94
                           '  hello.c\n'])
 
95