329
329
other_tree.unlock()
330
330
this_tree.merge_from_branch(other_tree.branch)
332
out,err = self.run_bzr('commit -m added')
331
out, err = self.run_bzr('commit -m added', working_dir='this')
333
332
self.assertEqual('', out)
334
333
self.assertEqual(set([
335
'Committing to: %s/' % osutils.getcwd(),
334
'Committing to: %s/' % osutils.pathjoin(osutils.getcwd(), 'this'),
336
335
'modified filetomodify',
472
471
t.add(['file-a', 'dir-a', 'dir-a/file-b'])
473
472
t.commit('Create')
474
473
t.remove(['file-a', 'dir-a/file-b'])
476
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]
477
476
self.assertNotContainsRe(result, 'file-a')
478
result = self.run_bzr('status')[0]
477
result = self.run_bzr('status', working_dir='dir-a')[0]
479
478
self.assertContainsRe(result, 'removed:\n file-a')
481
480
def test_strict_commit(self):
485
484
self.build_tree(['tree/a'])
487
486
# A simple change should just work
488
self.run_bzr('commit --strict -m adding-a',
487
self.run_bzr('commit --strict -m adding-a', working_dir='tree')
491
489
def test_strict_commit_no_changes(self):
492
490
"""commit --strict gives "no changes" if there is nothing to commit"""
830
828
"""Ensure commit error if username is not set.
832
830
self.run_bzr(['init', 'foo'])
834
open('foo.txt', 'w').write('hello')
835
self.run_bzr(['add'])
831
with open('foo/foo.txt', 'w') as f:
833
self.run_bzr(['add'], working_dir='foo')
836
834
self.overrideEnv('EMAIL', None)
837
835
self.overrideEnv('BZR_EMAIL', None)
838
836
# Also, make sure that it's not inferred from mailname.
839
837
self.overrideAttr(config, '_auto_user_id',
840
838
lambda: (None, None))
841
out, err = self.run_bzr(['commit', '-m', 'initial'], 3)
842
self.assertContainsRe(err, 'Unable to determine your name')
840
['Unable to determine your name'],
841
['commit', '-m', 'initial'], working_dir='foo')
844
843
def test_commit_recursive_checkout(self):
845
844
"""Ensure that a commit to a recursive checkout fails cleanly.
847
846
self.run_bzr(['init', 'test_branch'])
848
847
self.run_bzr(['checkout', 'test_branch', 'test_checkout'])
849
os.chdir('test_checkout')
850
self.run_bzr(['bind', '.']) # bind to self
851
open('foo.txt', 'w').write('hello')
852
self.run_bzr(['add'])
853
out, err = self.run_bzr(['commit', '-m', 'addedfoo'], 3)
854
self.assertEqual(out, '')
855
self.assertContainsRe(err,
856
'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')
858
856
def test_mv_dirs_non_ascii(self):
859
857
"""Move directory with non-ascii name and containing files.