328
329
other_tree.unlock()
329
330
this_tree.merge_from_branch(other_tree.branch)
331
out,err = self.run_bzr('commit -m added')
331
out, err = self.run_bzr('commit -m added', working_dir='this')
332
332
self.assertEqual('', out)
333
333
self.assertEqual(set([
334
'Committing to: %s/' % osutils.getcwd(),
334
'Committing to: %s/' % osutils.pathjoin(osutils.getcwd(), 'this'),
335
335
'modified filetomodify',
471
471
t.add(['file-a', 'dir-a', 'dir-a/file-b'])
472
472
t.commit('Create')
473
473
t.remove(['file-a', 'dir-a/file-b'])
475
result = self.run_bzr('commit . -m removed-file-b')[1]
474
result = self.run_bzr('commit . -m removed-file-b',
475
working_dir='dir-a')[1]
476
476
self.assertNotContainsRe(result, 'file-a')
477
result = self.run_bzr('status')[0]
477
result = self.run_bzr('status', working_dir='dir-a')[0]
478
478
self.assertContainsRe(result, 'removed:\n file-a')
480
480
def test_strict_commit(self):
829
828
"""Ensure commit error if username is not set.
831
830
self.run_bzr(['init', 'foo'])
833
open('foo.txt', 'w').write('hello')
834
self.run_bzr(['add'])
831
with open('foo/foo.txt', 'w') as f:
833
self.run_bzr(['add'], working_dir='foo')
835
834
self.overrideEnv('EMAIL', None)
836
835
self.overrideEnv('BZR_EMAIL', None)
837
836
# Also, make sure that it's not inferred from mailname.
838
837
self.overrideAttr(config, '_auto_user_id',
839
838
lambda: (None, None))
840
out, err = self.run_bzr(['commit', '-m', 'initial'], 3)
841
self.assertContainsRe(err, 'Unable to determine your name')
840
['Unable to determine your name'],
841
['commit', '-m', 'initial'], working_dir='foo')
843
843
def test_commit_recursive_checkout(self):
844
844
"""Ensure that a commit to a recursive checkout fails cleanly.
846
846
self.run_bzr(['init', 'test_branch'])
847
847
self.run_bzr(['checkout', 'test_branch', 'test_checkout'])
848
os.chdir('test_checkout')
849
self.run_bzr(['bind', '.']) # bind to self
850
open('foo.txt', 'w').write('hello')
851
self.run_bzr(['add'])
852
out, err = self.run_bzr(['commit', '-m', 'addedfoo'], 3)
853
self.assertEqual(out, '')
854
self.assertContainsRe(err,
855
'Branch.*test_checkout.*appears to be bound to itself')
848
self.run_bzr(['bind', '.'], working_dir='test_checkout') # bind to self
849
with open('test_checkout/foo.txt', 'w') as f:
851
self.run_bzr(['add'], working_dir='test_checkout')
852
out, err = self.run_bzr_error(
853
['Branch.*test_checkout.*appears to be bound to itself'],
854
['commit', '-m', 'addedfoo'], working_dir='test_checkout')
856
def test_mv_dirs_non_ascii(self):
857
"""Move directory with non-ascii name and containing files.
859
Regression test for bug 185211.
861
tree = self.make_branch_and_tree('.')
862
self.build_tree([u'abc\xa7/', u'abc\xa7/foo'])
864
tree.add([u'abc\xa7/', u'abc\xa7/foo'])
865
tree.commit('checkin')
867
tree.rename_one(u'abc\xa7','abc')
869
self.run_bzr('ci -m "non-ascii mv"')
858
872
class TestSmartServerCommit(TestCaseWithTransport):
873
887
# being too low. If rpc_count increases, more network roundtrips have
874
888
# become necessary for this use case. Please do not adjust this number
875
889
# upwards without agreement from bzr's network support maintainers.
876
self.assertLength(220, self.hpss_calls)
890
self.assertLength(214, self.hpss_calls)
891
self.assertLength(2, self.hpss_connections)
892
self.expectFailure("commit still uses VFS calls",
893
self.assertThat, self.hpss_calls, ContainsNoVfsCalls)