1
# Copyright (C) 2005-2010 Canonical Ltd
1
# Copyright (C) 2005, 2006 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
472
472
self.assertEqual("working tree is out of date, run 'bzr update'\n",
475
def test_status_on_ignored(self):
476
"""Tests branch status on an unversioned file which is considered ignored.
478
See https://bugs.launchpad.net/bzr/+bug/40103
480
tree = self.make_branch_and_tree('.')
482
self.build_tree(['test1.c', 'test1.c~', 'test2.c~'])
483
result = self.run_bzr('status')[0]
484
self.assertContainsRe(result, "unknown:\n test1.c\n")
485
short_result = self.run_bzr('status --short')[0]
486
self.assertContainsRe(short_result, "\? test1.c\n")
488
result = self.run_bzr('status test1.c')[0]
489
self.assertContainsRe(result, "unknown:\n test1.c\n")
490
short_result = self.run_bzr('status --short test1.c')[0]
491
self.assertContainsRe(short_result, "\? test1.c\n")
493
result = self.run_bzr('status test1.c~')[0]
494
self.assertContainsRe(result, "ignored:\n test1.c~\n")
495
short_result = self.run_bzr('status --short test1.c~')[0]
496
self.assertContainsRe(short_result, "I test1.c~\n")
498
result = self.run_bzr('status test1.c~ test2.c~')[0]
499
self.assertContainsRe(result, "ignored:\n test1.c~\n test2.c~\n")
500
short_result = self.run_bzr('status --short test1.c~ test2.c~')[0]
501
self.assertContainsRe(short_result, "I test1.c~\nI test2.c~\n")
503
result = self.run_bzr('status test1.c test1.c~ test2.c~')[0]
504
self.assertContainsRe(result, "unknown:\n test1.c\nignored:\n test1.c~\n test2.c~\n")
505
short_result = self.run_bzr('status --short test1.c test1.c~ test2.c~')[0]
506
self.assertContainsRe(short_result, "\? test1.c\nI test1.c~\nI test2.c~\n")
508
475
def test_status_write_lock(self):
509
476
"""Test that status works without fetching history and
510
477
having a write lock.
705
672
class TestStatusEncodings(TestCaseWithTransport):
675
TestCaseWithTransport.setUp(self)
676
self.user_encoding = osutils._cached_user_encoding
677
self.stdout = sys.stdout
680
osutils._cached_user_encoding = self.user_encoding
681
sys.stdout = self.stdout
682
TestCaseWithTransport.tearDown(self)
707
684
def make_uncommitted_tree(self):
708
685
"""Build a branch with uncommitted unicode named changes in the cwd."""
709
686
working_tree = self.make_branch_and_tree(u'.')
717
694
return working_tree
719
696
def test_stdout_ascii(self):
720
self.overrideAttr(osutils, '_cached_user_encoding', 'ascii')
697
sys.stdout = StringIO()
698
osutils._cached_user_encoding = 'ascii'
721
699
working_tree = self.make_uncommitted_tree()
722
700
stdout, stderr = self.run_bzr("status")
729
707
def test_stdout_latin1(self):
730
self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
708
sys.stdout = StringIO()
709
osutils._cached_user_encoding = 'latin-1'
731
710
working_tree = self.make_uncommitted_tree()
732
711
stdout, stderr = self.run_bzr('status')