1645
1645
def __init__(self, dirname, root_id):
1646
1646
self.name = dirname
1647
1647
os.mkdir(dirname)
1648
self.wt = ControlDir.create_standalone_workingtree(dirname)
1648
self.wt = BzrDir.create_standalone_workingtree(dirname)
1649
1649
self.wt.set_root_id(root_id)
1650
1650
self.b = self.wt.branch
1651
1651
self.tt = TreeTransform(self.wt)
1881
1881
def test_build_tree_with_symlinks(self):
1882
1882
self.requireFeature(SymlinkFeature)
1884
a = ControlDir.create_standalone_workingtree('a')
1884
a = BzrDir.create_standalone_workingtree('a')
1885
1885
os.mkdir('a/foo')
1886
1886
with file('a/foo/bar', 'wb') as f: f.write('contents')
1887
1887
os.symlink('a/foo/bar', 'a/foo/baz')
1888
1888
a.add(['foo', 'foo/bar', 'foo/baz'])
1889
1889
a.commit('initial commit')
1890
b = ControlDir.create_standalone_workingtree('b')
1890
b = BzrDir.create_standalone_workingtree('b')
1891
1891
basis = a.basis_tree()
1892
1892
basis.lock_read()
1893
1893
self.addCleanup(basis.unlock)
2410
2410
self.assertEqual('tree', revision.properties['branch-nick'])
2413
class TestBackupName(tests.TestCase):
2415
def test_deprecations(self):
2416
class MockTransform(object):
2418
def has_named_child(self, by_parent, parent_id, name):
2419
return name in by_parent.get(parent_id, [])
2421
class MockEntry(object):
2424
object.__init__(self)
2427
tt = MockTransform()
2428
name1 = self.applyDeprecated(
2429
symbol_versioning.deprecated_in((2, 3, 0)),
2430
transform.get_backup_name, MockEntry(), {'a':[]}, 'a', tt)
2431
self.assertEqual('name.~1~', name1)
2432
name2 = self.applyDeprecated(
2433
symbol_versioning.deprecated_in((2, 3, 0)),
2434
transform._get_backup_name, 'name', {'a':['name.~1~']}, 'a', tt)
2435
self.assertEqual('name.~2~', name2)
2413
2438
class TestFileMover(tests.TestCaseWithTransport):
2415
2440
def test_file_mover(self):