33
34
def test_cwd_log(self):
34
35
tmp_dir = osutils.mkdtemp()
36
# We expect a read-to-root attempt to occur.
37
self.permit_url('file:///')
35
38
self.addCleanup(lambda: osutils.rmtree(tmp_dir))
36
self.addCleanup(lambda: os.chdir('..'))
38
out, err = self.run_bzr('log', retcode=3)
39
out, err = self.run_bzr('log', retcode=3, working_dir=tmp_dir)
39
40
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n'
40
% (osutils.getcwd(),),
43
44
def test_url_log(self):
47
48
u' "%s".\n' % url, err)
49
50
def test_diff_outside_tree(self):
51
tree = self.make_branch_and_tree('branch1')
52
tree.commit('nothing')
53
tree.commit('nothing')
54
# A directory we can run commands from which we hope is not contained
55
# in a bzr tree (though if there is one at or above $TEMPDIR, this is
56
# false and may cause test failures).
50
57
tmp_dir = osutils.mkdtemp()
51
58
self.addCleanup(lambda: osutils.rmtree(tmp_dir))
52
self.addCleanup(lambda: os.chdir('..'))
54
self.run_bzr('init branch1')
55
self.run_bzr(['commit', '-m', 'nothing',
56
'--unchanged', 'branch1'])
57
self.run_bzr(['commit', '-m', 'nothing',
58
'--unchanged', 'branch1'])
59
this_dir = osutils.getcwd()
60
branch2 = "%s/branch2" % (this_dir,)
59
# We expect a read-to-root attempt to occur.
60
self.permit_url('file:///')
61
expected_error = u'bzr: ERROR: Not a branch: "%s/branch2/".\n' % tmp_dir
62
out, err = self.run_bzr('diff -r revno:2:branch2..revno:1', retcode=3)
63
self.assertEquals('', out)
64
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n' % (branch2,),
63
out, err = self.run_bzr('diff -r revno:2:branch2..revno:1', retcode=3,
65
self.assertEqual('', out)
66
self.assertEqual(expected_error, err)
67
out, err = self.run_bzr('diff -r revno:2:branch2', retcode=3)
68
self.assertEquals('', out)
69
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n' % (branch2,),
68
out, err = self.run_bzr('diff -r revno:2:branch2', retcode=3,
70
self.assertEqual('', out)
71
self.assertEqual(expected_error, err)
72
out, err = self.run_bzr('diff -r revno:2:branch2..', retcode=3)
73
self.assertEquals('', out)
74
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n' % (branch2,),
73
out, err = self.run_bzr('diff -r revno:2:branch2..', retcode=3,
75
self.assertEqual('', out)
76
self.assertEqual(expected_error, err)
77
out, err = self.run_bzr('diff', retcode=3)
78
self.assertEquals('', out)
79
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n' % (this_dir,),
78
out, err = self.run_bzr('diff', retcode=3, working_dir=tmp_dir)
79
self.assertEqual('', out)
80
self.assertEqual(u'bzr: ERROR: Not a branch: "%s/".\n' % tmp_dir, err)