45
45
from bzrlib.errors import BzrCommandError
46
46
from bzrlib.osutils import has_symlinks, pathjoin
47
47
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
48
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
48
49
from bzrlib.tests.blackbox import ExternalBase
50
51
class TestCommands(ExternalBase):
345
346
zf = ZipFile('../first-zip')
346
347
self.assert_('first-zip/hello' in zf.namelist(), zf.namelist())
349
self.example_branch()
350
file('hello', 'wt').write('hello world!')
351
self.runbzr('commit -m fixing hello')
352
output = self.runbzr('diff -r 2..3', backtick=1, retcode=1)
353
self.assert_('\n+hello world!' in output)
354
output = self.runbzr('diff -r last:3..last:1', backtick=1, retcode=1)
355
self.assert_('\n+baz' in output)
356
file('moo', 'wb').write('moo')
357
self.runbzr('add moo')
361
def test_diff_branches(self):
362
self.build_tree(['branch1/', 'branch1/file', 'branch2/'], line_endings='binary')
363
branch = Branch.initialize('branch1')
364
branch.working_tree().add(['file'])
365
branch.working_tree().commit('add file')
366
copy_branch(branch, 'branch2')
367
print >> open('branch2/file', 'wb'), 'new content'
368
branch2 = Branch.open('branch2')
369
branch2.working_tree().commit('update file')
370
# should open branch1 and diff against branch2,
371
output = self.run_bzr_captured(['diff', '-r', 'branch:branch2',
374
self.assertEquals(("=== modified file 'file'\n"
379
"+contents of branch1/file\n"
381
output = self.run_bzr_captured(['diff', 'branch2', 'branch1'],
383
self.assertEqualDiff(("=== modified file 'file'\n"
388
"+contents of branch1/file\n"
392
349
def test_branch(self):
393
350
"""Branch from one branch to another."""
1294
1251
branch.working_tree().commit('add file', rev_id='A')
1295
1252
url = self.get_remote_url('branch/')
1296
1253
self.run_bzr('check', url)
1256
class HTTPTests(TestCaseWithWebserver, RemoteTests):
1257
"""Test various commands against a HTTP server."""
1260
class SFTPTestsAbsolute(TestCaseWithSFTPServer, RemoteTests):
1261
"""Test various commands against a SFTP server using abs paths."""
1264
class SFTPTestsAbsoluteSibling(TestCaseWithSFTPServer, RemoteTests):
1265
"""Test various commands against a SFTP server using abs paths."""
1268
super(SFTPTestsAbsoluteSibling, self).setUp()
1269
self._override_home = '/dev/noone/runs/tests/here'
1272
class SFTPTestsRelative(TestCaseWithSFTPServer, RemoteTests):
1273
"""Test various commands against a SFTP server using homedir rel paths."""
1276
super(SFTPTestsRelative, self).setUp()
1277
self._get_remote_is_absolute = False