/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

1st cut merge of bzr.dev r3907

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    bzrdir,
33
33
    conflicts,
34
34
    errors,
 
35
    osutils,
35
36
    )
36
37
import bzrlib.branch
37
38
from bzrlib.osutils import pathjoin
298
299
        self.assertEqual("working tree is out of date, run 'bzr update'\n",
299
300
                         err)
300
301
 
 
302
    def test_status_write_lock(self):
 
303
        """Test that status works without fetching history and
 
304
        having a write lock.
 
305
 
 
306
        See https://bugs.launchpad.net/bzr/+bug/149270
 
307
        """
 
308
        mkdir('branch1')
 
309
        wt = self.make_branch_and_tree('branch1')
 
310
        b = wt.branch
 
311
        wt.commit('Empty commit 1')
 
312
        wt2 = b.bzrdir.sprout('branch2').open_workingtree()
 
313
        wt2.commit('Empty commit 2')
 
314
        out, err = self.run_bzr('status branch1 -rbranch:branch2')
 
315
        self.assertEqual('', out)
 
316
 
301
317
 
302
318
class CheckoutStatus(BranchStatus):
303
319
 
442
458
        out, err = self.run_bzr('status --no-pending', working_dir='a')
443
459
        self.assertEquals(out, "added:\n  b\n")
444
460
 
 
461
    def test_pending_specific_files(self):
 
462
        """With a specific file list, pending merges are not shown."""
 
463
        tree = self.make_branch_and_tree('tree')
 
464
        self.build_tree_contents([('tree/a', 'content of a\n')])
 
465
        tree.add('a')
 
466
        r1_id = tree.commit('one')
 
467
        alt = tree.bzrdir.sprout('alt').open_workingtree()
 
468
        self.build_tree_contents([('alt/a', 'content of a\nfrom alt\n')])
 
469
        alt_id = alt.commit('alt')
 
470
        tree.merge_from_branch(alt.branch)
 
471
        output = self.make_utf8_encoded_stringio()
 
472
        show_tree_status(tree, to_file=output)
 
473
        self.assertContainsRe(output.getvalue(), 'pending merges:')
 
474
        out, err = self.run_bzr('status tree/a')
 
475
        self.assertNotContainsRe(out, 'pending merges:')
 
476
 
445
477
 
446
478
class TestStatusEncodings(TestCaseWithTransport):
447
479
    
448
480
    def setUp(self):
449
481
        TestCaseWithTransport.setUp(self)
450
 
        self.user_encoding = bzrlib.user_encoding
 
482
        self.user_encoding = osutils._cached_user_encoding
451
483
        self.stdout = sys.stdout
452
484
 
453
485
    def tearDown(self):
469
501
 
470
502
    def test_stdout_ascii(self):
471
503
        sys.stdout = StringIO()
472
 
        bzrlib.user_encoding = 'ascii'
 
504
        osutils._cached_user_encoding = 'ascii'
473
505
        working_tree = self.make_uncommitted_tree()
474
506
        stdout, stderr = self.run_bzr("status")
475
507
 
480
512
 
481
513
    def test_stdout_latin1(self):
482
514
        sys.stdout = StringIO()
483
 
        bzrlib.user_encoding = 'latin-1'
 
515
        osutils._cached_user_encoding = 'latin-1'
484
516
        working_tree = self.make_uncommitted_tree()
485
517
        stdout, stderr = self.run_bzr('status')
486
518