~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge from integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
from bzrlib.branch import Branch
44
44
from bzrlib.clone import copy_branch
45
45
from bzrlib.errors import BzrCommandError
46
 
from bzrlib.osutils import has_symlinks
 
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):
215
216
        os.rmdir('revertdir')
216
217
        self.runbzr('revert')
217
218
 
218
 
        os.symlink('/unlikely/to/exist', 'symlink')
219
 
        self.runbzr('add symlink')
220
 
        self.runbzr('commit -m f')
221
 
        os.unlink('symlink')
222
 
        self.runbzr('revert')
223
 
        self.failUnlessExists('symlink')
224
 
        os.unlink('symlink')
225
 
        os.symlink('a-different-path', 'symlink')
226
 
        self.runbzr('revert')
227
 
        self.assertEqual('/unlikely/to/exist',
228
 
                         os.readlink('symlink'))
 
219
        if has_symlinks():
 
220
            os.symlink('/unlikely/to/exist', 'symlink')
 
221
            self.runbzr('add symlink')
 
222
            self.runbzr('commit -m f')
 
223
            os.unlink('symlink')
 
224
            self.runbzr('revert')
 
225
            self.failUnlessExists('symlink')
 
226
            os.unlink('symlink')
 
227
            os.symlink('a-different-path', 'symlink')
 
228
            self.runbzr('revert')
 
229
            self.assertEqual('/unlikely/to/exist',
 
230
                             os.readlink('symlink'))
 
231
        else:
 
232
            self.log("skipping revert symlink tests")
229
233
        
230
234
        file('hello', 'wt').write('xyz')
231
235
        self.runbzr('commit -m xyz hello')
674
678
        self.assertEquals(['If you wish to add some of these files, please'\
675
679
                           ' add them by name.',
676
680
                           'added dir',
677
 
                           'added dir'+os.sep+'sub.txt',
 
681
                           'added dir/sub.txt',
678
682
                           'added top.txt',
679
683
                           'ignored 1 file(s) matching "CVS"'],
680
684
                          results)
728
732
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
729
733
        self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
730
734
        self.run_bzr('add', '--no-recurse', 'inertiatic')
731
 
        self.assertEquals(self.capture('unknowns'), 'inertiatic'+os.sep+'esp\n')
 
735
        self.assertEquals(self.capture('unknowns'), 'inertiatic/esp\n')
732
736
        self.run_bzr('add', 'inertiatic/esp')
733
737
        self.assertEquals(self.capture('unknowns'), '')
734
738
 
1007
1011
        runbzr('init')
1008
1012
 
1009
1013
        self.assertEquals(capture('root').rstrip(),
1010
 
                          os.path.join(self.test_dir, 'branch1'))
 
1014
                          pathjoin(self.test_dir, 'branch1'))
1011
1015
 
1012
1016
        progress("status of new file")
1013
1017
 
1083
1087
        runbzr("rename sub1 sub2")
1084
1088
        runbzr("move hello.txt sub2")
1085
1089
        self.assertEqual(capture("relpath sub2/hello.txt"),
1086
 
                         os.path.join("sub2", "hello.txt\n"))
 
1090
                         pathjoin("sub2", "hello.txt\n"))
1087
1091
 
1088
1092
        self.assert_(exists("sub2"))
1089
1093
        self.assert_(exists("sub2/hello.txt"))
1105
1109
 
1106
1110
        chdir('sub1/sub2')
1107
1111
        self.assertEquals(capture('root')[:-1],
1108
 
                          os.path.join(self.test_dir, 'branch1'))
 
1112
                          pathjoin(self.test_dir, 'branch1'))
1109
1113
        runbzr('move ../hello.txt .')
1110
1114
        self.assert_(exists('./hello.txt'))
1111
1115
        self.assertEquals(capture('relpath hello.txt'),
1112
 
                          os.path.join('sub1', 'sub2', 'hello.txt') + '\n')
1113
 
        self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
 
1116
                          pathjoin('sub1', 'sub2', 'hello.txt') + '\n')
 
1117
        self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n'))
1114
1118
        runbzr(['commit', '-m', 'move to parent directory'])
1115
1119
        chdir('..')
1116
 
        self.assertEquals(capture('relpath sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
 
1120
        self.assertEquals(capture('relpath sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n'))
1117
1121
 
1118
1122
        runbzr('move sub2/hello.txt .')
1119
1123
        self.assert_(exists('hello.txt'))
1263
1267
            progress("skipping symlink tests")
1264
1268
 
1265
1269
 
1266
 
class HttpTests(TestCaseWithWebserver):
 
1270
class RemoteTests(object):
1267
1271
    """Test bzr ui commands against remote branches."""
1268
1272
 
1269
1273
    def test_branch(self):
1291
1295
        branch.working_tree().commit('add file', rev_id='A')
1292
1296
        url = self.get_remote_url('branch/')
1293
1297
        self.run_bzr('check', url)
 
1298
    
 
1299
    
 
1300
class HTTPTests(TestCaseWithWebserver, RemoteTests):
 
1301
    """Test various commands against a HTTP server."""
 
1302
    
 
1303
    
 
1304
class SFTPTestsAbsolute(TestCaseWithSFTPServer, RemoteTests):
 
1305
    """Test various commands against a SFTP server using abs paths."""
 
1306
 
 
1307
    
 
1308
class SFTPTestsAbsoluteSibling(TestCaseWithSFTPServer, RemoteTests):
 
1309
    """Test various commands against a SFTP server using abs paths."""
 
1310
 
 
1311
    def setUp(self):
 
1312
        super(SFTPTestsAbsoluteSibling, self).setUp()
 
1313
        self._override_home = '/dev/noone/runs/tests/here'
 
1314
 
 
1315
    
 
1316
class SFTPTestsRelative(TestCaseWithSFTPServer, RemoteTests):
 
1317
    """Test various commands against a SFTP server using homedir rel paths."""
 
1318
 
 
1319
    def setUp(self):
 
1320
        super(SFTPTestsRelative, self).setUp()
 
1321
        self._get_remote_is_absolute = False