~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

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,
31
32
    tests,
32
33
    treebuilder,
33
34
    )
64
65
 
65
66
 
66
67
class MockTree(object):
 
68
 
67
69
    def __init__(self):
68
70
        from bzrlib.inventory import InventoryDirectory, ROOT_ID
69
71
        object.__init__(self)
74
76
 
75
77
    inventory = property(lambda x:x)
76
78
 
77
 
    def __iter__(self):
78
 
        return self.paths.iterkeys()
 
79
    def all_file_ids(self):
 
80
        return set(self.paths.keys())
79
81
 
80
82
    def __getitem__(self, file_id):
81
83
        if file_id == self.root.file_id:
142
144
        result.seek(0,0)
143
145
        return result
144
146
 
 
147
    def get_file_revision(self, file_id):
 
148
        return self.inventory[file_id].revision
 
149
 
145
150
    def contents_stats(self, file_id):
146
151
        if file_id not in self.contents:
147
152
            return None, None
489
494
                                 % (ancestor,))
490
495
 
491
496
                # Now check that the file contents are all correct
492
 
                for inventory_id in old:
 
497
                for inventory_id in old.all_file_ids():
493
498
                    try:
494
499
                        old_file = old.get_file(inventory_id)
495
500
                    except errors.NoSuchFile:
503
508
                old.unlock()
504
509
        if not _mod_revision.is_null(rev_id):
505
510
            rh = self.b1.revision_history()
506
 
            tree.branch.set_revision_history(rh[:rh.index(rev_id)+1])
 
511
            self.applyDeprecated(symbol_versioning.deprecated_in((2, 4, 0)),
 
512
                tree.branch.set_revision_history, rh[:rh.index(rev_id)+1])
507
513
            tree.update()
508
514
            delta = tree.changes_from(self.b1.repository.revision_tree(rev_id))
509
515
            self.assertFalse(delta.has_changed(),
1439
1445
        install_bundle(repo_b, serializer.read(s))
1440
1446
 
1441
1447
 
1442
 
class V4WeaveBundleTester(V4BundleTester):
1443
 
 
1444
 
    def bzrdir_format(self):
1445
 
        return 'metaweave'
1446
 
 
1447
 
 
1448
1448
class V4_2aBundleTester(V4BundleTester):
1449
1449
 
1450
1450
    def bzrdir_format(self):