~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

(gz) Fix test failure on alpha by correcting format string for
 gc_chk_sha1_record (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    merge,
29
29
    osutils,
30
30
    revision as _mod_revision,
31
 
    symbol_versioning,
32
31
    tests,
33
32
    treebuilder,
34
33
    )
46
45
    test_commit,
47
46
    )
48
47
from bzrlib.transform import TreeTransform
49
 
from bzrlib.tests import (
50
 
    features,
51
 
    )
52
48
 
53
49
 
54
50
def get_text(vf, key):
68
64
 
69
65
 
70
66
class MockTree(object):
71
 
 
72
67
    def __init__(self):
73
68
        from bzrlib.inventory import InventoryDirectory, ROOT_ID
74
69
        object.__init__(self)
79
74
 
80
75
    inventory = property(lambda x:x)
81
76
 
82
 
    def all_file_ids(self):
83
 
        return set(self.paths.keys())
 
77
    def __iter__(self):
 
78
        return self.paths.iterkeys()
84
79
 
85
80
    def __getitem__(self, file_id):
86
81
        if file_id == self.root.file_id:
147
142
        result.seek(0,0)
148
143
        return result
149
144
 
150
 
    def get_file_revision(self, file_id):
151
 
        return self.inventory[file_id].revision
152
 
 
153
145
    def contents_stats(self, file_id):
154
146
        if file_id not in self.contents:
155
147
            return None, None
497
489
                                 % (ancestor,))
498
490
 
499
491
                # Now check that the file contents are all correct
500
 
                for inventory_id in old.all_file_ids():
 
492
                for inventory_id in old:
501
493
                    try:
502
494
                        old_file = old.get_file(inventory_id)
503
495
                    except errors.NoSuchFile:
511
503
                old.unlock()
512
504
        if not _mod_revision.is_null(rev_id):
513
505
            rh = self.b1.revision_history()
514
 
            self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
515
 
                tree.branch.set_revision_history, rh[:rh.index(rev_id)+1])
 
506
            tree.branch.set_revision_history(rh[:rh.index(rev_id)+1])
516
507
            tree.update()
517
508
            delta = tree.changes_from(self.b1.repository.revision_tree(rev_id))
518
509
            self.assertFalse(delta.has_changed(),
685
676
    def _test_symlink_bundle(self, link_name, link_target, new_link_target):
686
677
        link_id = 'link-1'
687
678
 
688
 
        self.requireFeature(features.SymlinkFeature)
 
679
        self.requireFeature(tests.SymlinkFeature)
689
680
        self.tree1 = self.make_branch_and_tree('b1')
690
681
        self.b1 = self.tree1.branch
691
682
 
732
723
        self._test_symlink_bundle('link', 'bar/foo', 'mars')
733
724
 
734
725
    def test_unicode_symlink_bundle(self):
735
 
        self.requireFeature(features.UnicodeFilenameFeature)
 
726
        self.requireFeature(tests.UnicodeFilenameFeature)
736
727
        self._test_symlink_bundle(u'\N{Euro Sign}link',
737
728
                                  u'bar/\N{Euro Sign}foo',
738
729
                                  u'mars\N{Euro Sign}')
839
830
        return bundle_file.getvalue()
840
831
 
841
832
    def test_unicode_bundle(self):
842
 
        self.requireFeature(features.UnicodeFilenameFeature)
 
833
        self.requireFeature(tests.UnicodeFilenameFeature)
843
834
        # Handle international characters
844
835
        os.mkdir('b1')
845
836
        f = open(u'b1/with Dod\N{Euro Sign}', 'wb')
1418
1409
        branch = tree_a.branch
1419
1410
        repo_a = branch.repository
1420
1411
        tree_a.commit("base", allow_pointless=True, rev_id='A')
1421
 
        self.assertFalse(branch.repository.has_signature_for_revision_id('A'))
 
1412
        self.failIf(branch.repository.has_signature_for_revision_id('A'))
1422
1413
        try:
1423
1414
            from bzrlib.testament import Testament
1424
1415
            # monkey patch gpg signing mechanism
1448
1439
        install_bundle(repo_b, serializer.read(s))
1449
1440
 
1450
1441
 
 
1442
class V4WeaveBundleTester(V4BundleTester):
 
1443
 
 
1444
    def bzrdir_format(self):
 
1445
        return 'metaweave'
 
1446
 
 
1447
 
1451
1448
class V4_2aBundleTester(V4BundleTester):
1452
1449
 
1453
1450
    def bzrdir_format(self):