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
48
from bzrlib.tests.blackbox import ExternalBase
215
215
os.rmdir('revertdir')
216
216
self.runbzr('revert')
218
os.symlink('/unlikely/to/exist', 'symlink')
219
self.runbzr('add symlink')
220
self.runbzr('commit -m f')
222
self.runbzr('revert')
223
self.failUnlessExists('symlink')
225
os.symlink('a-different-path', 'symlink')
226
self.runbzr('revert')
227
self.assertEqual('/unlikely/to/exist',
228
os.readlink('symlink'))
219
os.symlink('/unlikely/to/exist', 'symlink')
220
self.runbzr('add symlink')
221
self.runbzr('commit -m f')
223
self.runbzr('revert')
224
self.failUnlessExists('symlink')
226
os.symlink('a-different-path', 'symlink')
227
self.runbzr('revert')
228
self.assertEqual('/unlikely/to/exist',
229
os.readlink('symlink'))
231
self.log("skipping revert symlink tests")
230
233
file('hello', 'wt').write('xyz')
231
234
self.runbzr('commit -m xyz hello')
674
677
self.assertEquals(['If you wish to add some of these files, please'\
675
678
' add them by name.',
677
'added dir'+os.sep+'sub.txt',
679
682
'ignored 1 file(s) matching "CVS"'],
728
731
self.build_tree(['inertiatic/', 'inertiatic/esp'])
729
732
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
730
733
self.run_bzr('add', '--no-recurse', 'inertiatic')
731
self.assertEquals(self.capture('unknowns'), 'inertiatic'+os.sep+'esp\n')
734
self.assertEquals(self.capture('unknowns'), 'inertiatic/esp\n')
732
735
self.run_bzr('add', 'inertiatic/esp')
733
736
self.assertEquals(self.capture('unknowns'), '')
1009
1012
self.assertEquals(capture('root').rstrip(),
1010
os.path.join(self.test_dir, 'branch1'))
1013
pathjoin(self.test_dir, 'branch1'))
1012
1015
progress("status of new file")
1083
1086
runbzr("rename sub1 sub2")
1084
1087
runbzr("move hello.txt sub2")
1085
1088
self.assertEqual(capture("relpath sub2/hello.txt"),
1086
os.path.join("sub2", "hello.txt\n"))
1089
pathjoin("sub2", "hello.txt\n"))
1088
1091
self.assert_(exists("sub2"))
1089
1092
self.assert_(exists("sub2/hello.txt"))
1106
1109
chdir('sub1/sub2')
1107
1110
self.assertEquals(capture('root')[:-1],
1108
os.path.join(self.test_dir, 'branch1'))
1111
pathjoin(self.test_dir, 'branch1'))
1109
1112
runbzr('move ../hello.txt .')
1110
1113
self.assert_(exists('./hello.txt'))
1111
1114
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'))
1115
pathjoin('sub1', 'sub2', 'hello.txt') + '\n')
1116
self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n'))
1114
1117
runbzr(['commit', '-m', 'move to parent directory'])
1116
self.assertEquals(capture('relpath sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
1119
self.assertEquals(capture('relpath sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n'))
1118
1121
runbzr('move sub2/hello.txt .')
1119
1122
self.assert_(exists('hello.txt'))