~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Vincent Ladeuil
  • Date: 2011-08-12 09:49:24 UTC
  • mfrom: (6015.9.10 2.4)
  • mto: This revision was merged to the branch mainline in revision 6066.
  • Revision ID: v.ladeuil+lp@free.fr-20110812094924-knc5s0g7vs31a2f1
Merge 2.4 into trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
from bzrlib.merge import Merge3Merger, Merger
63
63
from bzrlib.tests import (
64
64
    features,
 
65
    TestCaseInTempDir,
 
66
    TestSkipped,
 
67
    )
 
68
from bzrlib.tests.features import (
65
69
    HardlinkFeature,
66
70
    SymlinkFeature,
67
 
    TestCaseInTempDir,
68
 
    TestSkipped,
69
 
)
 
71
    )
70
72
from bzrlib.transform import (
71
73
    build_tree,
72
74
    create_from_tree,
321
323
        new_trans_id = transform.new_directory('', ROOT_PARENT, 'alt-root-id')
322
324
        self.assertRaises(ValueError, transform.fixup_new_roots)
323
325
 
 
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))
 
333
 
324
334
    def test_apply_retains_root_directory(self):
325
335
        # Do not attempt to delete the physical root directory, because that
326
336
        # is impossible.
332
342
                                  transform.apply)
333
343
        self.assertContainsRe('TransformRenameFailed not raised', str(e))
334
344
 
 
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)
 
349
        transform.apply()
 
350
        self.assertEqual(old_root_id, self.wt.get_root_id())
 
351
 
335
352
    def test_hardlink(self):
336
353
        self.requireFeature(HardlinkFeature)
337
354
        transform, root = self.get_transform()
764
781
                            'wizard2', 'behind_curtain')
765
782
 
766
783
    def test_symlinks_unicode(self):
767
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
784
        self.requireFeature(features.UnicodeFilenameFeature)
768
785
        self._test_symlinks(u'\N{Euro Sign}wizard',
769
786
                            u'wizard-targ\N{Euro Sign}t',
770
787
                            u'\N{Euro Sign}wizard2',
2209
2226
        self.assertEqualStat(source_stat, target_stat)
2210
2227
 
2211
2228
    def test_case_insensitive_build_tree_inventory(self):
2212
 
        if (tests.CaseInsensitiveFilesystemFeature.available()
2213
 
            or tests.CaseInsCasePresFilenameFeature.available()):
 
2229
        if (features.CaseInsensitiveFilesystemFeature.available()
 
2230
            or features.CaseInsCasePresFilenameFeature.available()):
2214
2231
            raise tests.UnavailableFeature('Fully case sensitive filesystem')
2215
2232
        source = self.make_branch_and_tree('source')
2216
2233
        self.build_tree(['source/file', 'source/FILE'])
3329
3346
        self.assertEqual('contents', rev2_tree.get_file_text('file_id'))
3330
3347
 
3331
3348
    def test_ascii_limbo_paths(self):
3332
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
3349
        self.requireFeature(features.UnicodeFilenameFeature)
3333
3350
        branch = self.make_branch('any')
3334
3351
        tree = branch.repository.revision_tree(_mod_revision.NULL_REVISION)
3335
3352
        tt = TransformPreview(tree)
3352
3369
 
3353
3370
class TestSerializeTransform(tests.TestCaseWithTransport):
3354
3371
 
3355
 
    _test_needs_features = [tests.UnicodeFilenameFeature]
 
3372
    _test_needs_features = [features.UnicodeFilenameFeature]
3356
3373
 
3357
3374
    def get_preview(self, tree=None):
3358
3375
        if tree is None:
3433
3450
        return self.make_records(attribs, contents)
3434
3451
 
3435
3452
    def test_serialize_symlink_creation(self):
3436
 
        self.requireFeature(tests.SymlinkFeature)
 
3453
        self.requireFeature(features.SymlinkFeature)
3437
3454
        tt = self.get_preview()
3438
3455
        tt.new_symlink(u'foo\u1234', tt.root, u'bar\u1234')
3439
3456
        self.assertSerializesTo(self.symlink_creation_records(), tt)
3440
3457
 
3441
3458
    def test_deserialize_symlink_creation(self):
3442
 
        self.requireFeature(tests.SymlinkFeature)
 
3459
        self.requireFeature(features.SymlinkFeature)
3443
3460
        tt = self.get_preview()
3444
3461
        tt.deserialize(iter(self.symlink_creation_records()))
3445
3462
        abspath = tt._limbo_name('new-1')