~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_status.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
class BranchStatus(TestCaseWithTransport):
45
45
    
46
46
    def assertStatus(self, expected_lines, working_tree,
47
 
        revision=None, short=False):
 
47
        revision=None, short=False, pending=True):
48
48
        """Run status in working_tree and look for output.
49
49
        
50
50
        :param expected_lines: The lines to look for.
51
51
        :param working_tree: The tree to run status in.
52
52
        """
53
 
        output_string = self.status_string(working_tree, revision, short)
 
53
        output_string = self.status_string(working_tree, revision, short,
 
54
                pending)
54
55
        self.assertEqual(expected_lines, output_string.splitlines(True))
55
56
    
56
 
    def status_string(self, wt, revision=None, short=False):
 
57
    def status_string(self, wt, revision=None, short=False, pending=True):
57
58
        # use a real file rather than StringIO because it doesn't handle
58
59
        # Unicode very well.
59
60
        tof = codecs.getwriter('utf-8')(TemporaryFile())
60
 
        show_tree_status(wt, to_file=tof, revision=revision, short=short)
 
61
        show_tree_status(wt, to_file=tof, revision=revision, short=short,
 
62
                show_pending=pending)
61
63
        tof.seek(0)
62
64
        return tof.read().decode('utf-8')
63
65
 
102
104
                'P   pending@pending-0-0\n',
103
105
            ],
104
106
            wt, short=True)
 
107
        self.assertStatus([
 
108
                'unknown:\n',
 
109
                '  bye.c\n',
 
110
                '  hello.c\n',
 
111
            ],
 
112
            wt, pending=False)
 
113
        self.assertStatus([
 
114
                '?   bye.c\n',
 
115
                '?   hello.c\n',
 
116
            ],
 
117
            wt, short=True, pending=False)
105
118
 
106
119
    def test_branch_status_revisions(self):
107
120
        """Tests branch status with revisions"""
415
428
        out, err = self.run_bzr('status -r 1..23..123', retcode=3)
416
429
        self.assertContainsRe(err, 'one or two revision specifiers')
417
430
 
 
431
    def test_status_no_pending(self):
 
432
        a_tree = self.make_branch_and_tree('a')
 
433
        self.build_tree(['a/a'])
 
434
        a_tree.add('a')
 
435
        a_tree.commit('a')
 
436
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
 
437
        self.build_tree(['b/b'])
 
438
        b_tree.add('b')
 
439
        b_tree.commit('b')
 
440
 
 
441
        chdir('a')
 
442
        self.run_bzr('merge ../b')
 
443
        out, err = self.run_bzr('status --no-pending')
 
444
        self.assertEquals(out, "added:\n  b\n")
 
445
 
 
446
 
418
447
 
419
448
class TestStatusEncodings(TestCaseWithTransport):
420
449