39
39
from bzrlib.branch import Branch
40
40
from bzrlib.clone import copy_branch
41
41
from bzrlib.errors import BzrCommandError
42
from bzrlib.osutils import has_symlinks
42
from bzrlib.osutils import has_symlinks, pathjoin
43
43
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
44
44
from bzrlib.tests.blackbox import ExternalBase
211
211
os.rmdir('revertdir')
212
212
self.runbzr('revert')
214
os.symlink('/unlikely/to/exist', 'symlink')
215
self.runbzr('add symlink')
216
self.runbzr('commit -m f')
218
self.runbzr('revert')
219
self.failUnlessExists('symlink')
221
os.symlink('a-different-path', 'symlink')
222
self.runbzr('revert')
223
self.assertEqual('/unlikely/to/exist',
224
os.readlink('symlink'))
215
os.symlink('/unlikely/to/exist', 'symlink')
216
self.runbzr('add symlink')
217
self.runbzr('commit -m f')
219
self.runbzr('revert')
220
self.failUnlessExists('symlink')
222
os.symlink('a-different-path', 'symlink')
223
self.runbzr('revert')
224
self.assertEqual('/unlikely/to/exist',
225
os.readlink('symlink'))
227
self.log("skipping revert symlink tests")
226
229
file('hello', 'wt').write('xyz')
227
230
self.runbzr('commit -m xyz hello')
668
671
# the ordering is not defined at the moment
669
672
results = sorted(out.rstrip('\n').split('\n'))
670
673
self.assertEquals(['added dir',
671
'added dir'+os.sep+'sub.txt',
672
675
'added top.txt',],
715
718
self.build_tree(['inertiatic/', 'inertiatic/esp'])
716
719
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
717
720
self.run_bzr('add', '--no-recurse', 'inertiatic')
718
self.assertEquals(self.capture('unknowns'), 'inertiatic'+os.sep+'esp\n')
721
self.assertEquals(self.capture('unknowns'), 'inertiatic/esp\n')
719
722
self.run_bzr('add', 'inertiatic/esp')
720
723
self.assertEquals(self.capture('unknowns'), '')
996
999
self.assertEquals(capture('root').rstrip(),
997
os.path.join(self.test_dir, 'branch1'))
1000
pathjoin(self.test_dir, 'branch1'))
999
1002
progress("status of new file")
1070
1073
runbzr("rename sub1 sub2")
1071
1074
runbzr("move hello.txt sub2")
1072
1075
self.assertEqual(capture("relpath sub2/hello.txt"),
1073
os.path.join("sub2", "hello.txt\n"))
1076
pathjoin("sub2", "hello.txt\n"))
1075
1078
self.assert_(exists("sub2"))
1076
1079
self.assert_(exists("sub2/hello.txt"))
1093
1096
chdir('sub1/sub2')
1094
1097
self.assertEquals(capture('root')[:-1],
1095
os.path.join(self.test_dir, 'branch1'))
1098
pathjoin(self.test_dir, 'branch1'))
1096
1099
runbzr('move ../hello.txt .')
1097
1100
self.assert_(exists('./hello.txt'))
1098
1101
self.assertEquals(capture('relpath hello.txt'),
1099
os.path.join('sub1', 'sub2', 'hello.txt') + '\n')
1100
self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
1102
pathjoin('sub1', 'sub2', 'hello.txt') + '\n')
1103
self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n'))
1101
1104
runbzr(['commit', '-m', 'move to parent directory'])
1103
self.assertEquals(capture('relpath sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
1106
self.assertEquals(capture('relpath sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n'))
1105
1108
runbzr('move sub2/hello.txt .')
1106
1109
self.assert_(exists('hello.txt'))