1229
1230
tt.version_file("bar-1", bar_trans_id)
1231
1232
self.failUnlessExists("foo/bar")
1235
self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1240
changes = wt.changes_from(wt.basis_tree())
1241
self.assertFalse(changes.has_changed(), changes)
1243
def test_file_to_symlink(self):
1244
self.requireFeature(SymlinkFeature)
1245
wt = self.make_branch_and_tree('.')
1246
self.build_tree(['foo'])
1249
tt = TreeTransform(wt)
1250
self.addCleanup(tt.finalize)
1251
foo_trans_id = tt.trans_id_tree_path("foo")
1252
tt.delete_contents(foo_trans_id)
1253
tt.create_symlink("bar", foo_trans_id)
1255
self.failUnlessExists("foo")
1257
self.addCleanup(wt.unlock)
1258
self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1261
def test_dir_to_file(self):
1262
wt = self.make_branch_and_tree('.')
1263
self.build_tree(['foo/', 'foo/bar'])
1264
wt.add(['foo', 'foo/bar'])
1266
tt = TreeTransform(wt)
1267
self.addCleanup(tt.finalize)
1268
foo_trans_id = tt.trans_id_tree_path("foo")
1269
bar_trans_id = tt.trans_id_tree_path("foo/bar")
1270
tt.delete_contents(foo_trans_id)
1271
tt.delete_versioned(bar_trans_id)
1272
tt.create_file(["aa\n"], foo_trans_id)
1274
self.failUnlessExists("foo")
1276
self.addCleanup(wt.unlock)
1277
self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1280
def test_dir_to_hardlink(self):
1281
self.requireFeature(HardlinkFeature)
1282
wt = self.make_branch_and_tree('.')
1283
self.build_tree(['foo/', 'foo/bar'])
1284
wt.add(['foo', 'foo/bar'])
1286
tt = TreeTransform(wt)
1287
self.addCleanup(tt.finalize)
1288
foo_trans_id = tt.trans_id_tree_path("foo")
1289
bar_trans_id = tt.trans_id_tree_path("foo/bar")
1290
tt.delete_contents(foo_trans_id)
1291
tt.delete_versioned(bar_trans_id)
1292
self.build_tree(['baz'])
1293
tt.create_hardlink("baz", foo_trans_id)
1295
self.failUnlessExists("foo")
1296
self.failUnlessExists("baz")
1298
self.addCleanup(wt.unlock)
1299
self.assertEqual(wt.inventory.get_file_kind(wt.path2id("foo")),
1234
1303
class TransformGroup(object):