~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_too_much.py

[merge] jam-integration 1503

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
49
50
 
50
51
class TestCommands(ExternalBase):
345
346
        zf = ZipFile('../first-zip')
346
347
        self.assert_('first-zip/hello' in zf.namelist(), zf.namelist())
347
348
 
348
 
    def test_diff(self):
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')
358
 
        os.unlink('moo')
359
 
        self.runbzr('diff')
360
 
 
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', 
372
 
                                        'branch1'],
373
 
                                       retcode=1)
374
 
        self.assertEquals(("=== modified file 'file'\n"
375
 
                           "--- file\t\n"
376
 
                           "+++ file\t\n"
377
 
                           "@@ -1,1 +1,1 @@\n"
378
 
                           "-new content\n"
379
 
                           "+contents of branch1/file\n"
380
 
                           "\n", ''), output)
381
 
        output = self.run_bzr_captured(['diff', 'branch2', 'branch1'],
382
 
                                       retcode=1)
383
 
        self.assertEqualDiff(("=== modified file 'file'\n"
384
 
                              "--- file\t\n"
385
 
                              "+++ file\t\n"
386
 
                              "@@ -1,1 +1,1 @@\n"
387
 
                              "-new content\n"
388
 
                              "+contents of branch1/file\n"
389
 
                              "\n", ''), output)
390
 
 
391
 
 
392
349
    def test_branch(self):
393
350
        """Branch from one branch to another."""
394
351
        os.mkdir('a')
1266
1223
            progress("skipping symlink tests")
1267
1224
 
1268
1225
 
1269
 
class HttpTests(TestCaseWithWebserver):
 
1226
class RemoteTests(object):
1270
1227
    """Test bzr ui commands against remote branches."""
1271
1228
 
1272
1229
    def test_branch(self):
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)
 
1254
    
 
1255
    
 
1256
class HTTPTests(TestCaseWithWebserver, RemoteTests):
 
1257
    """Test various commands against a HTTP server."""
 
1258
    
 
1259
    
 
1260
class SFTPTestsAbsolute(TestCaseWithSFTPServer, RemoteTests):
 
1261
    """Test various commands against a SFTP server using abs paths."""
 
1262
 
 
1263
    
 
1264
class SFTPTestsAbsoluteSibling(TestCaseWithSFTPServer, RemoteTests):
 
1265
    """Test various commands against a SFTP server using abs paths."""
 
1266
 
 
1267
    def setUp(self):
 
1268
        super(SFTPTestsAbsoluteSibling, self).setUp()
 
1269
        self._override_home = '/dev/noone/runs/tests/here'
 
1270
 
 
1271
    
 
1272
class SFTPTestsRelative(TestCaseWithSFTPServer, RemoteTests):
 
1273
    """Test various commands against a SFTP server using homedir rel paths."""
 
1274
 
 
1275
    def setUp(self):
 
1276
        super(SFTPTestsRelative, self).setUp()
 
1277
        self._get_remote_is_absolute = False