46
46
# If forced, it should succeed, but this is not tested here.
47
47
self.make_branch_and_tree('.')
48
48
self.build_tree(['hello.txt'])
49
out, err = self.run_bzr('commit -m empty', retcode=3)
49
out,err = self.run_bzr('commit -m empty', retcode=3)
50
50
self.assertEqual('', out)
51
51
# Two ugly bits here.
52
52
# 1) We really don't want 'aborting commit write group' anymore.
58
58
brz: ERROR: No changes to commit.\
59
59
Please 'brz add' the files you want to commit,\
60
60
or use --unchanged to force an empty commit.
61
""", flags=doctest.ELLIPSIS | doctest.REPORT_UDIFF))
61
""", flags=doctest.ELLIPSIS|doctest.REPORT_UDIFF))
63
63
def test_commit_success(self):
64
64
"""Successful commit should not leave behind a bzr-commit-* file"""
79
79
def test_commit_lossy_foreign(self):
80
80
test_foreign.register_dummy_foreign_for_test(self)
81
81
self.make_branch_and_tree('.',
82
format=test_foreign.DummyForeignVcsDirFormat())
82
format=test_foreign.DummyForeignVcsDirFormat())
83
83
self.run_bzr('commit --lossy --unchanged -m message')
84
84
output = self.run_bzr('revision-info')[0]
85
85
self.assertTrue(output.startswith('1 dummy-'))
92
92
self.run_bzr(['commit', '-m', 'first commit', 'a'])
94
94
b_tree = a_tree.controldir.sprout('b').open_workingtree()
95
self.build_tree_contents([('b/a_file', b'changes in b')])
95
self.build_tree_contents([('b/a_file', 'changes in b')])
96
96
self.run_bzr(['commit', '-m', 'first commit in b', 'b'])
98
self.build_tree_contents([('a/a_file', b'new contents')])
98
self.build_tree_contents([('a/a_file', 'new contents')])
99
99
self.run_bzr(['commit', '-m', 'change in a', 'a'])
101
101
b_tree.merge_from_branch(a_tree.branch)
108
108
tree = self.make_branch_and_tree('.')
109
109
self.build_tree(['hello.txt'])
110
110
tree.add("hello.txt")
111
out, err = self.run_bzr('commit -m added')
111
out,err = self.run_bzr('commit -m added')
112
112
self.assertEqual('', out)
113
113
self.assertContainsRe(err, '^Committing to: .*\n'
114
114
'added hello.txt\n'
126
126
def test_verbose_commit_modified(self):
127
127
# Verbose commit of modified file should say so
128
128
wt = self.prepare_simple_history()
129
self.build_tree_contents([('hello.txt', b'new contents')])
129
self.build_tree_contents([('hello.txt', 'new contents')])
130
130
out, err = self.run_bzr('commit -m modified')
131
131
self.assertEqual('', out)
132
132
self.assertContainsRe(err, '^Committing to: .*\n'
133
'modified hello\\.txt\n'
134
'Committed revision 2\\.\n$')
133
'modified hello\.txt\n'
134
'Committed revision 2\.\n$')
136
136
def test_unicode_commit_message_is_filename(self):
137
137
"""Unicode commit message same as a filename (Bug #563646).
139
139
self.requireFeature(features.UnicodeFilenameFeature)
140
140
file_name = u'\N{euro sign}'
141
141
self.run_bzr(['init'])
142
with open(file_name, 'w') as f:
143
f.write('hello world')
142
with open(file_name, 'w') as f: f.write('hello world')
144
143
self.run_bzr(['add'])
145
144
out, err = self.run_bzr(['commit', '-m', file_name])
146
reflags = re.MULTILINE | re.DOTALL | re.UNICODE
145
reflags = re.MULTILINE|re.DOTALL|re.UNICODE
147
146
te = osutils.get_terminal_encoding()
148
self.assertContainsRe(err,
149
u'The commit message is a file name:',
147
self.assertContainsRe(err.decode(te),
148
u'The commit message is a file name:',
152
151
# Run same test with a filename that causes encode
153
152
# error for the terminal encoding. We do this
159
158
osutils.get_terminal_encoding = lambda trace=None: 'ascii'
160
159
file_name = u'foo\u1234'
161
with open(file_name, 'w') as f:
162
f.write('hello world')
160
with open(file_name, 'w') as f: f.write('hello world')
163
161
self.run_bzr(['add'])
164
162
out, err = self.run_bzr(['commit', '-m', file_name])
165
reflags = re.MULTILINE | re.DOTALL | re.UNICODE
163
reflags = re.MULTILINE|re.DOTALL|re.UNICODE
166
164
te = osutils.get_terminal_encoding()
167
self.assertContainsRe(err,
168
u'The commit message is a file name:',
165
self.assertContainsRe(err.decode(te, 'replace'),
166
u'The commit message is a file name:',
171
169
osutils.get_terminal_encoding = default_get_terminal_enc
175
173
tree = self.make_branch_and_tree(".")
176
174
self.build_tree(["f"])
178
out, err = self.run_bzr_raw(["commit", "-m", "Wrong filename", u"\xa7"],
179
encoding="utf-8", retcode=3)
180
self.assertContainsRe(err, b"(?m)not versioned: \"\xc2\xa7\"$")
176
out, err = self.run_bzr(["commit", "-m", "Wrong filename", u"\xa7"],
177
encoding="utf-8", retcode=3)
178
self.assertContainsRe(err, "(?m)not versioned: \"\xc2\xa7\"$")
182
180
def test_non_ascii_file_unversioned_iso_8859_5(self):
183
181
self.requireFeature(features.UnicodeFilenameFeature)
184
182
tree = self.make_branch_and_tree(".")
185
183
self.build_tree(["f"])
187
out, err = self.run_bzr_raw(["commit", "-m", "Wrong filename", u"\xa7"],
188
encoding="iso-8859-5", retcode=3)
189
self.assertNotContainsString(err, b"\xc2\xa7")
190
self.assertContainsRe(err, b"(?m)not versioned: \"\xfd\"$")
185
out, err = self.run_bzr(["commit", "-m", "Wrong filename", u"\xa7"],
186
encoding="iso-8859-5", retcode=3)
187
self.expectFailure("Error messages are always written as UTF-8",
188
self.assertNotContainsString, err, "\xc2\xa7")
189
self.assertContainsRe(err, "(?m)not versioned: \"\xfd\"$")
192
191
def test_warn_about_forgotten_commit_message(self):
193
192
"""Test that the lack of -m parameter is caught"""
204
203
out, err = self.run_bzr('commit -m renamed')
205
204
self.assertEqual('', out)
206
205
self.assertContainsRe(err, '^Committing to: .*\n'
207
'renamed hello\\.txt => gutentag\\.txt\n'
208
'Committed revision 2\\.$\n')
206
'renamed hello\.txt => gutentag\.txt\n'
207
'Committed revision 2\.$\n')
210
209
def test_verbose_commit_moved(self):
211
210
# Verbose commit of file moved to new directory should say so
229
228
wt = ControlDir.create_standalone_workingtree('.')
230
229
self.build_tree(['hello.txt', 'extra.txt'])
231
230
wt.add(['hello.txt'])
232
out, err = self.run_bzr('commit -m added')
231
out,err = self.run_bzr('commit -m added')
233
232
self.assertEqual('', out)
234
233
self.assertContainsRe(err, '^Committing to: .*\n'
235
'added hello\\.txt\n'
236
'Committed revision 1\\.\n$')
235
'Committed revision 1\.\n$')
238
237
def test_verbose_commit_with_unchanged(self):
239
238
"""Unchanged files should not be listed by default in verbose output"""
242
241
tree.add('unchanged.txt')
243
242
self.run_bzr('commit -m unchanged unchanged.txt')
244
243
tree.add("hello.txt")
245
out, err = self.run_bzr('commit -m added')
244
out,err = self.run_bzr('commit -m added')
246
245
self.assertEqual('', out)
247
246
self.assertContainsRe(err, '^Committing to: .*\n'
248
'added hello\\.txt\n'
249
'Committed revision 2\\.$\n')
248
'Committed revision 2\.$\n')
251
250
def test_verbose_commit_includes_master_location(self):
252
251
"""Location of master is displayed when committing to bound branch"""
310
309
this_tree.commit('create_files')
311
310
other_dir = this_tree.controldir.sprout('other')
312
311
other_tree = other_dir.open_workingtree()
313
with other_tree.lock_write():
314
# perform the needed actions on the files and dirs.
312
other_tree.lock_write()
313
# perform the needed actions on the files and dirs.
315
315
other_tree.rename_one('dirtorename', 'renameddir')
316
316
other_tree.rename_one('dirtoreparent', 'renameddir/reparenteddir')
317
317
other_tree.rename_one('filetorename', 'renamedfile')
320
320
other_tree.remove(['dirtoremove', 'filetoremove'])
321
321
self.build_tree_contents([
322
322
('other/newdir/',),
323
('other/filetomodify', b'new content'),
324
('other/newfile', b'new file content')])
323
('other/filetomodify', 'new content'),
324
('other/newfile', 'new file content')])
325
325
other_tree.add('newfile')
326
326
other_tree.add('newdir/')
327
327
other_tree.commit('modify all sample files and dirs.')
328
330
this_tree.merge_from_branch(other_tree.branch)
329
331
out, err = self.run_bzr('commit -m added', working_dir='this')
330
332
self.assertEqual('', out)
346
348
def test_empty_commit_message(self):
347
349
tree = self.make_branch_and_tree('.')
348
self.build_tree_contents([('foo.c', b'int main() {}')])
350
self.build_tree_contents([('foo.c', 'int main() {}')])
349
351
tree.add('foo.c')
350
352
self.run_bzr('commit -m ""')
355
357
outer_tree = self.make_branch_and_tree('.')
356
358
inner_tree = self.make_branch_and_tree('branch')
357
359
self.build_tree_contents([
358
('branch/foo.c', b'int main() {}'),
359
('branch/bar.c', b'int main() {}')])
360
('branch/foo.c', 'int main() {}'),
361
('branch/bar.c', 'int main() {}')])
360
362
inner_tree.add(['foo.c', 'bar.c'])
361
363
# can't commit files in different trees; sane error
362
364
self.run_bzr('commit -m newstuff branch/foo.c .', retcode=3)
365
367
# can commit to branch - records bar.c
366
368
self.run_bzr('commit -m newstuff branch')
367
369
# No changes left
368
self.run_bzr_error(["No changes to commit"],
369
'commit -m newstuff branch')
370
self.run_bzr_error(["No changes to commit"], 'commit -m newstuff branch')
371
372
def test_out_of_date_tree_commit(self):
372
373
# check we get an error code and a clear message committing with an out
402
403
trunk = self.make_branch_and_tree('trunk')
404
405
u1 = trunk.branch.create_checkout('u1')
405
self.build_tree_contents([('u1/hosts', b'initial contents\n')])
406
self.build_tree_contents([('u1/hosts', 'initial contents\n')])
407
408
self.run_bzr('commit -m add-hosts u1')
409
410
u2 = trunk.branch.create_checkout('u2')
410
self.build_tree_contents([('u2/hosts', b'altered in u2\n')])
411
self.build_tree_contents([('u2/hosts', 'altered in u2\n')])
411
412
self.run_bzr('commit -m checkin-from-u2 u2')
413
414
# make an offline commits
414
self.build_tree_contents(
415
[('u1/hosts', b'first offline change in u1\n')])
415
self.build_tree_contents([('u1/hosts', 'first offline change in u1\n')])
416
416
self.run_bzr('commit -m checkin-offline --local u1')
418
418
# now try to pull in online work from u2, and then commit our offline
419
419
# work as a merge
420
420
# retcode 1 as we expect a text conflict
421
421
self.run_bzr('update u1', retcode=1)
422
self.assertFileEqual(b'''\
422
self.assertFileEqual('''\
424
424
first offline change in u1
432
432
# add a text change here to represent resolving the merge conflicts in
433
433
# favour of a new version of the file not identical to either the u1
434
434
# version or the u2 version.
435
self.build_tree_contents([('u1/hosts', b'merge resolution\n')])
435
self.build_tree_contents([('u1/hosts', 'merge resolution\n')])
436
436
self.run_bzr('commit -m checkin-merge-of-the-offline-work-from-u1 u1')
438
438
def test_commit_exclude_excludes_modified_files(self):
530
530
'commit -m hello --fixes=lp:23452 tree/hello.txt')
531
531
self.assertEqual('', output)
532
532
self.assertContainsRe(err, 'Committing to: .*\n'
533
'added hello\\.txt\n'
534
'Committed revision 1\\.\n')
536
def test_fixes_bug_unicode(self):
537
"""commit --fixes=lp:unicode succeeds without output."""
538
tree = self.make_branch_and_tree('tree')
539
self.build_tree(['tree/hello.txt'])
540
tree.add('hello.txt')
541
output, err = self.run_bzr_raw(
542
['commit', '-m', 'hello',
543
u'--fixes=generic:\u20ac', 'tree/hello.txt'],
544
encoding='utf-8', retcode=3)
545
self.assertEqual(b'', output)
546
self.assertContainsRe(err,
547
b'brz: ERROR: Unrecognized bug generic:\xe2\x82\xac\\. Commit refused.\n')
534
'Committed revision 1\.\n')
549
536
def test_no_bugs_no_properties(self):
550
537
"""If no bugs are fixed, the bugs property is not set.
554
541
tree = self.make_branch_and_tree('tree')
555
542
self.build_tree(['tree/hello.txt'])
556
543
tree.add('hello.txt')
557
self.run_bzr('commit -m hello tree/hello.txt')
544
self.run_bzr( 'commit -m hello tree/hello.txt')
558
545
# Get the revision properties, ignoring the branch-nick property, which
559
546
# we don't care about for this test.
560
547
last_rev = tree.branch.repository.get_revision(tree.last_revision())
562
549
del properties['branch-nick']
563
550
self.assertFalse('bugs' in properties)
565
def test_bugs_sets_property(self):
566
"""commit --bugs=lp:234 sets the lp:234 revprop to 'related'."""
567
tree = self.make_branch_and_tree('tree')
568
self.build_tree(['tree/hello.txt'])
569
tree.add('hello.txt')
570
self.run_bzr('commit -m hello --bugs=lp:234 tree/hello.txt')
572
# Get the revision properties, ignoring the branch-nick property, which
573
# we don't care about for this test.
574
last_rev = tree.branch.repository.get_revision(tree.last_revision())
575
properties = dict(last_rev.properties)
576
del properties[u'branch-nick']
578
self.assertEqual({u'bugs': 'https://launchpad.net/bugs/234 related'},
581
552
def test_fixes_bug_sets_property(self):
582
553
"""commit --fixes=lp:234 sets the lp:234 revprop to 'fixed'."""
583
554
tree = self.make_branch_and_tree('tree')
589
560
# we don't care about for this test.
590
561
last_rev = tree.branch.repository.get_revision(tree.last_revision())
591
562
properties = dict(last_rev.properties)
592
del properties[u'branch-nick']
563
del properties['branch-nick']
594
self.assertEqual({u'bugs': 'https://launchpad.net/bugs/234 fixed'},
565
self.assertEqual({'bugs': 'https://launchpad.net/bugs/234 fixed'},
597
568
def test_fixes_multiple_bugs_sets_properties(self):
609
580
del properties['branch-nick']
611
582
self.assertEqual(
612
{u'bugs': 'https://launchpad.net/bugs/123 fixed\n'
613
'https://launchpad.net/bugs/235 fixed'},
583
{'bugs': 'https://launchpad.net/bugs/123 fixed\n'
584
'https://launchpad.net/bugs/235 fixed'},
616
587
def test_fixes_bug_with_alternate_trackers(self):
622
593
'trac_twisted_url', 'http://twistedmatrix.com/trac')
623
594
self.build_tree(['tree/hello.txt'])
624
595
tree.add('hello.txt')
626
'commit -m hello --fixes=lp:123 --fixes=twisted:235 tree/')
596
self.run_bzr('commit -m hello --fixes=lp:123 --fixes=twisted:235 tree/')
628
598
# Get the revision properties, ignoring the branch-nick property, which
629
599
# we don't care about for this test.
652
622
tree.add('hello.txt')
653
623
self.run_bzr_error(
654
624
["brz: ERROR: No tracker specified for bug 123. Use the form "
655
"'tracker:id' or specify a default bug tracker using the "
656
"`bugtracker` option.\n"
657
"See \"brz help bugs\" for more information on this feature. "
625
"'tracker:id' or specify a default bug tracker using the "
626
"`bugtracker` option.\n"
627
"See \"brz help bugs\" for more information on this feature. "
659
629
'commit -m add-b --fixes=123',
660
630
working_dir='tree')
661
631
tree.branch.get_config_stack().set("bugtracker", "lp")
692
662
tree = self.make_branch_and_tree('tree')
693
663
self.build_tree(['tree/hello.txt'])
694
664
tree.add('hello.txt')
695
self.run_bzr('commit -m hello tree/hello.txt')
665
self.run_bzr( 'commit -m hello tree/hello.txt')
696
666
last_rev = tree.branch.repository.get_revision(tree.last_revision())
697
667
properties = last_rev.properties
698
668
self.assertFalse('author' in properties)
706
676
tree.add('hello.txt')
707
677
self.run_bzr(["commit", '-m', 'hello',
708
678
'--author', u'John D\xf6 <jdoe@example.com>',
710
680
last_rev = tree.branch.repository.get_revision(tree.last_revision())
711
681
properties = last_rev.properties
712
self.assertEqual(u'John D\xf6 <jdoe@example.com>',
713
properties['authors'])
682
self.assertEqual(u'John D\xf6 <jdoe@example.com>', properties['authors'])
715
684
def test_author_no_email(self):
716
685
"""Author's name without an email address is allowed, too."""
739
708
self.build_tree(['tree/hello.txt'])
740
709
tree.add('hello.txt')
741
710
out, err = self.run_bzr("commit -m hello "
742
"--commit-time='2009-10-10 08:00:00 +0100' tree/hello.txt")
711
"--commit-time='2009-10-10 08:00:00 +0100' tree/hello.txt")
743
712
last_rev = tree.branch.repository.get_revision(tree.last_revision())
744
713
self.assertEqual(
745
714
'Sat 2009-10-10 08:00:00 +0100',
746
715
osutils.format_date(last_rev.timestamp, last_rev.timezone))
717
def test_commit_time_negative_windows(self):
718
tree = self.make_branch_and_tree('tree')
719
self.build_tree(['tree/hello.txt'])
720
tree.add('hello.txt')
721
out, err = self.run_bzr("commit -m hello "
722
"--commit-time='1969-10-10 00:00:00 +0000' tree/hello.txt")
723
last_rev = tree.branch.repository.get_revision(tree.last_revision())
725
'Fri 1969-10-10 00:00:00 +0000',
726
osutils.format_date(last_rev.timestamp, last_rev.timezone))
728
def test_commit_time_negative_32bit(self):
729
tree = self.make_branch_and_tree('tree')
730
self.build_tree(['tree/hello.txt'])
731
tree.add('hello.txt')
732
out, err = self.run_bzr("commit -m hello "
733
"--commit-time='1900-01-01 00:00:00 +0000' tree/hello.txt")
734
last_rev = tree.branch.repository.get_revision(tree.last_revision())
736
'Mon 1900-01-01 00:00:00 +0000',
737
osutils.format_date(last_rev.timestamp, last_rev.timezone))
739
def test_commit_time_positive_32bit(self):
740
tree = self.make_branch_and_tree('tree')
741
self.build_tree(['tree/hello.txt'])
742
tree.add('hello.txt')
743
out, err = self.run_bzr("commit -m hello "
744
"--commit-time='2039-01-01 00:00:00 +0000' tree/hello.txt")
745
last_rev = tree.branch.repository.get_revision(tree.last_revision())
747
'Sat 2039-01-01 00:00:00 +0000',
748
osutils.format_date(last_rev.timestamp, last_rev.timezone))
748
750
def test_commit_time_bad_time(self):
749
751
tree = self.make_branch_and_tree('tree')
750
752
self.build_tree(['tree/hello.txt'])
751
753
tree.add('hello.txt')
752
754
out, err = self.run_bzr("commit -m hello "
753
"--commit-time='NOT A TIME' tree/hello.txt", retcode=3)
755
"--commit-time='NOT A TIME' tree/hello.txt", retcode=3)
754
756
self.assertStartsWith(
755
757
err, "brz: ERROR: Could not parse --commit-time:")
759
761
self.build_tree(['tree/hello.txt'])
760
762
tree.add('hello.txt')
761
763
out, err = self.run_bzr("commit -m hello "
762
"--commit-time='2009-10-10 08:00:00' tree/hello.txt", retcode=3)
764
"--commit-time='2009-10-10 08:00:00' tree/hello.txt", retcode=3)
763
765
self.assertStartsWith(
764
766
err, "brz: ERROR: Could not parse --commit-time:")
765
767
# Test that it is actually checking and does not simply crash with
777
779
# then during partial commit we have error
778
780
# parent_id {dir-XXX} not in inventory
779
781
t.rename_one('dir/a', 'a')
780
self.build_tree_contents([('test', b'changes in test')])
782
self.build_tree_contents([('test', 'changes in test')])
782
784
out, err = self.run_bzr('commit test -m "partial commit"')
783
785
self.assertEqual('', out)
792
794
self.get_readonly_transport('master')).open_branch()
793
795
master.create_checkout('checkout')
794
796
out, err = self.run_bzr(['commit', '--unchanged', '-mfoo', 'checkout'],
796
798
self.assertContainsRe(err,
797
r'^brz: ERROR: Cannot lock.*readonly transport')
799
r'^brz: ERROR: Cannot lock.*readonly transport')
799
801
def setup_editor(self):
800
802
# Test that commit template hooks work
801
803
if sys.platform == "win32":
802
with open('fed.bat', 'w') as f:
803
f.write('@rem dummy fed')
804
f = file('fed.bat', 'w')
805
f.write('@rem dummy fed')
804
807
self.overrideEnv('BRZ_EDITOR', "fed.bat")
806
with open('fed.sh', 'wb') as f:
807
f.write(b'#!/bin/sh\n')
809
f = file('fed.sh', 'wb')
810
f.write('#!/bin/sh\n')
808
812
os.chmod('fed.sh', 0o755)
809
813
self.overrideEnv('BRZ_EDITOR', "./fed.sh")
811
815
def setup_commit_with_template(self):
812
816
self.setup_editor()
813
817
msgeditor.hooks.install_named_hook("commit_message_template",
814
lambda commit_obj, msg: "save me some typing\n", None)
818
lambda commit_obj, msg: "save me some typing\n", None)
815
819
tree = self.make_branch_and_tree('tree')
816
820
self.build_tree(['tree/hello.txt'])
817
821
tree.add('hello.txt')
823
827
self.build_tree(['tree/hello.txt'])
824
828
tree.add('hello.txt')
825
829
out, err = self.run_bzr("commit tree/hello.txt", retcode=3,
827
831
self.assertContainsRe(err,
828
"brz: ERROR: Empty commit message specified")
832
"brz: ERROR: Empty commit message specified")
830
834
def test_commit_hook_template_accepted(self):
831
835
tree = self.setup_commit_with_template()
837
841
tree = self.setup_commit_with_template()
838
842
expected = tree.last_revision()
839
843
out, err = self.run_bzr_error(["Empty commit message specified."
840
" Please specify a commit message with either"
841
" --message or --file or leave a blank message"
842
" with --message \"\"."],
843
"commit tree/hello.txt", stdin="n\n")
844
" Please specify a commit message with either"
845
" --message or --file or leave a blank message"
846
" with --message \"\"."],
847
"commit tree/hello.txt", stdin="n\n")
844
848
self.assertEqual(expected, tree.last_revision())
846
850
def test_set_commit_message(self):
847
851
msgeditor.hooks.install_named_hook("set_commit_message",
848
lambda commit_obj, msg: "save me some typing\n", None)
852
lambda commit_obj, msg: "save me some typing\n", None)
849
853
tree = self.make_branch_and_tree('tree')
850
854
self.build_tree(['tree/hello.txt'])
851
855
tree.add('hello.txt')
860
864
with open('foo/foo.txt', 'w') as f:
862
866
self.run_bzr(['add'], working_dir='foo')
863
override_whoami(self)
867
self.overrideEnv('EMAIL', None)
868
self.overrideEnv('BRZ_EMAIL', None)
869
# Also, make sure that it's not inferred from mailname.
870
self.overrideAttr(config, '_auto_user_id',
871
lambda: (None, None))
864
872
self.run_bzr_error(
865
873
['Unable to determine your name'],
866
874
['commit', '-m', 'initial'], working_dir='foo')
871
879
self.run_bzr(['init', 'test_branch'])
872
880
self.run_bzr(['checkout', 'test_branch', 'test_checkout'])
874
self.run_bzr(['bind', '.'], working_dir='test_checkout')
881
self.run_bzr(['bind', '.'], working_dir='test_checkout') # bind to self
875
882
with open('test_checkout/foo.txt', 'w') as f:
877
884
self.run_bzr(['add'], working_dir='test_checkout')
890
897
tree.add([u'abc\xa7/', u'abc\xa7/foo'])
891
898
tree.commit('checkin')
893
tree.rename_one(u'abc\xa7', 'abc')
900
tree.rename_one(u'abc\xa7','abc')
895
902
self.run_bzr('ci -m "non-ascii mv"')
905
class TestSmartServerCommit(TestCaseWithTransport):
907
def test_commit_to_lightweight(self):
908
self.setup_smart_server_with_call_log()
909
t = self.make_branch_and_tree('from')
910
for count in range(9):
911
t.commit(message='commit %d' % count)
912
out, err = self.run_bzr(['checkout', '--lightweight', self.get_url('from'),
914
self.reset_smart_call_log()
915
self.build_tree(['target/afile'])
916
self.run_bzr(['add', 'target/afile'])
917
out, err = self.run_bzr(['commit', '-m', 'do something', 'target'])
918
# This figure represent the amount of work to perform this use case. It
919
# is entirely ok to reduce this number if a test fails due to rpc_count
920
# being too low. If rpc_count increases, more network roundtrips have
921
# become necessary for this use case. Please do not adjust this number
922
# upwards without agreement from bzr's network support maintainers.
923
self.assertLength(211, self.hpss_calls)
924
self.assertLength(2, self.hpss_connections)
925
self.expectFailure("commit still uses VFS calls",
926
self.assertThat, self.hpss_calls, ContainsNoVfsCalls)