168
168
osutils.get_terminal_encoding = default_get_terminal_enc
170
def test_non_ascii_file_unversioned_utf8(self):
171
self.requireFeature(features.UnicodeFilenameFeature)
172
tree = self.make_branch_and_tree(".")
173
self.build_tree(["f"])
175
out, err = self.run_bzr(["commit", "-m", "Wrong filename", u"\xa7"],
176
encoding="utf-8", retcode=3)
177
self.assertContainsRe(err, "(?m)not versioned: \"\xc2\xa7\"$")
179
def test_non_ascii_file_unversioned_iso_8859_5(self):
180
self.requireFeature(features.UnicodeFilenameFeature)
181
tree = self.make_branch_and_tree(".")
182
self.build_tree(["f"])
184
out, err = self.run_bzr(["commit", "-m", "Wrong filename", u"\xa7"],
185
encoding="iso-8859-5", retcode=3)
186
self.expectFailure("Error messages are always written as UTF-8",
187
self.assertNotContainsString, err, "\xc2\xa7")
188
self.assertContainsRe(err, "(?m)not versioned: \"\xfd\"$")
170
190
def test_warn_about_forgotten_commit_message(self):
171
191
"""Test that the lack of -m parameter is caught"""
172
192
wt = self.make_branch_and_tree('.')
704
724
self.assertStartsWith(
705
725
err, "bzr: ERROR: Could not parse --commit-time:")
727
def test_commit_time_missing_tz(self):
728
tree = self.make_branch_and_tree('tree')
729
self.build_tree(['tree/hello.txt'])
730
tree.add('hello.txt')
731
out, err = self.run_bzr("commit -m hello "
732
"--commit-time='2009-10-10 08:00:00' tree/hello.txt", retcode=3)
733
self.assertStartsWith(
734
err, "bzr: ERROR: Could not parse --commit-time:")
735
# Test that it is actually checking and does not simply crash with
736
# some other exception
737
self.assertContainsString(err, "missing a timezone offset")
707
739
def test_partial_commit_with_renames_in_tree(self):
708
740
# this test illustrates bug #140419
709
741
t = self.make_branch_and_tree('.')
821
853
self.assertEqual(out, '')
822
854
self.assertContainsRe(err,
823
855
'Branch.*test_checkout.*appears to be bound to itself')
858
class TestSmartServerCommit(TestCaseWithTransport):
860
def test_commit_to_lightweight(self):
861
self.setup_smart_server_with_call_log()
862
t = self.make_branch_and_tree('from')
863
for count in range(9):
864
t.commit(message='commit %d' % count)
865
out, err = self.run_bzr(['checkout', '--lightweight', self.get_url('from'),
867
self.reset_smart_call_log()
868
self.build_tree(['target/afile'])
869
self.run_bzr(['add', 'target/afile'])
870
out, err = self.run_bzr(['commit', '-m', 'do something', 'target'])
871
# This figure represent the amount of work to perform this use case. It
872
# is entirely ok to reduce this number if a test fails due to rpc_count
873
# being too low. If rpc_count increases, more network roundtrips have
874
# become necessary for this use case. Please do not adjust this number
875
# upwards without agreement from bzr's network support maintainers.
876
self.assertLength(220, self.hpss_calls)