~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-02-01 19:18:09 UTC
  • mfrom: (6459 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6460.
  • Revision ID: jelmer@samba.org-20120201191809-xn340a5i5v4fqsfu
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
            status._show_shelve_summary,
54
54
            'bzr status')
55
55
 
56
 
    def assertStatus(self, expected_lines, working_tree,
 
56
    def assertStatus(self, expected_lines, working_tree, specific_files=None,
57
57
        revision=None, short=False, pending=True, verbose=False):
58
58
        """Run status in working_tree and look for output.
59
59
 
60
60
        :param expected_lines: The lines to look for.
61
61
        :param working_tree: The tree to run status in.
62
62
        """
63
 
        output_string = self.status_string(working_tree, revision, short,
 
63
        output_string = self.status_string(working_tree, specific_files, revision, short,
64
64
                pending, verbose)
65
65
        self.assertEqual(expected_lines, output_string.splitlines(True))
66
66
 
67
 
    def status_string(self, wt, revision=None, short=False, pending=True,
68
 
        verbose=False):
 
67
    def status_string(self, wt, specific_files=None, revision=None,
 
68
        short=False, pending=True, verbose=False):
69
69
        # use a real file rather than StringIO because it doesn't handle
70
70
        # Unicode very well.
71
71
        tof = codecs.getwriter('utf-8')(TemporaryFile())
72
 
        show_tree_status(wt, to_file=tof, revision=revision, short=short,
73
 
                show_pending=pending, verbose=verbose)
 
72
        show_tree_status(wt, specific_files=specific_files, to_file=tof,
 
73
                revision=revision, short=short, show_pending=pending,
 
74
                verbose=verbose)
74
75
        tof.seek(0)
75
76
        return tof.read().decode('utf-8')
76
77
 
569
570
            ],
570
571
            wt)
571
572
        self.run_bzr(['shelve', '--all', '-m', 'bar'])
572
 
        self.build_tree(['spam.c'])
 
573
        self.build_tree(['eggs.c', 'spam.c'])
 
574
        wt.add('eggs.c')
573
575
        wt.add('spam.c')
574
576
        self.assertStatus([
575
577
                'added:\n',
 
578
                '  eggs.c\n',
576
579
                '  spam.c\n',
577
580
                '2 shelves exist. See "bzr shelve --list" for details.\n',
578
581
            ],
579
582
            wt)
 
583
        self.assertStatus([
 
584
                'added:\n',
 
585
                '  spam.c\n',
 
586
            ],
 
587
            wt,
 
588
            specific_files=['spam.c'])
580
589
 
581
590
 
582
591
class CheckoutStatus(BranchStatus):
589
598
    def make_branch_and_tree(self, relpath):
590
599
        source = self.make_branch(pathjoin('..', relpath))
591
600
        checkout = bzrdir.BzrDirMetaFormat1().initialize(relpath)
592
 
        bzrlib.branch.BranchReferenceFormat().initialize(checkout,
593
 
            target_branch=source)
 
601
        checkout.set_branch_reference(source)
594
602
        return checkout.create_workingtree()
595
603
 
596
604