287
285
new_trans_id = transform.new_directory('', ROOT_PARENT, 'alt-root-id')
288
286
self.assertRaises(ValueError, transform.fixup_new_roots)
290
def test_retain_existing_root(self):
291
tt, root = self.get_transform()
293
tt.new_directory('', ROOT_PARENT, 'new-root-id')
295
self.assertNotEqual('new-root-id', tt.final_file_id(tt.root))
297
def test_retain_existing_root_added_file(self):
298
tt, root = self.get_transform()
299
new_trans_id = tt.new_directory('', ROOT_PARENT, 'new-root-id')
300
child = tt.new_directory('child', new_trans_id, 'child-id')
302
self.assertEqual(tt.root, tt.final_parent(child))
304
288
def test_add_unversioned_root(self):
305
289
transform, root = self.get_transform()
306
290
new_trans_id = transform.new_directory('', ROOT_PARENT, None)
307
transform.delete_contents(transform.root)
308
291
transform.fixup_new_roots()
309
292
self.assertNotIn(transform.root, transform._new_id)
311
def test_remove_root_fixup(self):
312
transform, root = self.get_transform()
313
old_root_id = self.wt.get_root_id()
314
self.assertNotEqual('new-root-id', old_root_id)
315
transform.delete_contents(root)
316
transform.unversion_file(root)
317
transform.fixup_new_roots()
319
self.assertEqual(old_root_id, self.wt.get_root_id())
321
transform, root = self.get_transform()
322
new_trans_id = transform.new_directory('', ROOT_PARENT, 'new-root-id')
323
new_trans_id = transform.new_directory('', ROOT_PARENT, 'alt-root-id')
324
self.assertRaises(ValueError, transform.fixup_new_roots)
326
def test_fixup_new_roots_permits_empty_tree(self):
327
transform, root = self.get_transform()
328
transform.delete_contents(root)
329
transform.unversion_file(root)
330
transform.fixup_new_roots()
331
self.assertIs(None, transform.final_kind(root))
332
self.assertIs(None, transform.final_file_id(root))
334
294
def test_apply_retains_root_directory(self):
335
295
# Do not attempt to delete the physical root directory, because that
343
303
self.assertContainsRe('TransformRenameFailed not raised', str(e))
345
def test_apply_retains_file_id(self):
346
transform, root = self.get_transform()
347
old_root_id = transform.tree_file_id(root)
348
transform.unversion_file(root)
350
self.assertEqual(old_root_id, self.wt.get_root_id())
352
305
def test_hardlink(self):
353
306
self.requireFeature(HardlinkFeature)
354
307
transform, root = self.get_transform()
781
734
'wizard2', 'behind_curtain')
783
736
def test_symlinks_unicode(self):
784
self.requireFeature(features.UnicodeFilenameFeature)
737
self.requireFeature(tests.UnicodeFilenameFeature)
785
738
self._test_symlinks(u'\N{Euro Sign}wizard',
786
739
u'wizard-targ\N{Euro Sign}t',
787
740
u'\N{Euro Sign}wizard2',
2226
2179
self.assertEqualStat(source_stat, target_stat)
2228
2181
def test_case_insensitive_build_tree_inventory(self):
2229
if (features.CaseInsensitiveFilesystemFeature.available()
2230
or features.CaseInsCasePresFilenameFeature.available()):
2182
if (tests.CaseInsensitiveFilesystemFeature.available()
2183
or tests.CaseInsCasePresFilenameFeature.available()):
2231
2184
raise tests.UnavailableFeature('Fully case sensitive filesystem')
2232
2185
source = self.make_branch_and_tree('source')
2233
2186
self.build_tree(['source/file', 'source/FILE'])
3346
3299
self.assertEqual('contents', rev2_tree.get_file_text('file_id'))
3348
3301
def test_ascii_limbo_paths(self):
3349
self.requireFeature(features.UnicodeFilenameFeature)
3302
self.requireFeature(tests.UnicodeFilenameFeature)
3350
3303
branch = self.make_branch('any')
3351
3304
tree = branch.repository.revision_tree(_mod_revision.NULL_REVISION)
3352
3305
tt = TransformPreview(tree)
3450
3403
return self.make_records(attribs, contents)
3452
3405
def test_serialize_symlink_creation(self):
3453
self.requireFeature(features.SymlinkFeature)
3406
self.requireFeature(tests.SymlinkFeature)
3454
3407
tt = self.get_preview()
3455
3408
tt.new_symlink(u'foo\u1234', tt.root, u'bar\u1234')
3456
3409
self.assertSerializesTo(self.symlink_creation_records(), tt)
3458
3411
def test_deserialize_symlink_creation(self):
3459
self.requireFeature(features.SymlinkFeature)
3412
self.requireFeature(tests.SymlinkFeature)
3460
3413
tt = self.get_preview()
3461
3414
tt.deserialize(iter(self.symlink_creation_records()))
3462
3415
abspath = tt._limbo_name('new-1')