~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Aaron Bentley
  • Date: 2008-04-28 00:49:40 UTC
  • mto: This revision was merged to the branch mainline in revision 3392.
  • Revision ID: aaron@aaronbentley.com-20080428004940-hipydum9ucwsc0qu
Test that the stored inventory hash is correct when bundles are used

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
                           NoSuchFile,)
43
43
from bzrlib.merge import Merge3Merger
44
44
from bzrlib.repofmt import knitrepo
45
 
from bzrlib.osutils import sha_file
 
45
from bzrlib.osutils import sha_file, sha_string
46
46
from bzrlib.tests import (
47
47
    SymlinkFeature,
48
48
    TestCase,
1015
1015
        self.assertNotContainsRe(inv_text, 'format="5"')
1016
1016
        self.assertContainsRe(inv_text, 'format="7"')
1017
1017
 
 
1018
    def make_repo_with_installed_revisions(self):
 
1019
        tree = self.make_simple_tree('knit')
 
1020
        tree.commit('hello', rev_id='rev1')
 
1021
        tree.commit('hello', rev_id='rev2')
 
1022
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
 
1023
        repo = self.make_repository('repo', format='dirstate-with-subtree')
 
1024
        bundle.install_revisions(repo)
 
1025
        inv = repo.get_inventory('rev2')
 
1026
        return repo
 
1027
 
1018
1028
    def test_across_models(self):
1019
 
        tree = self.make_simple_tree('knit')
1020
 
        tree.commit('hello', rev_id='rev1')
1021
 
        tree.commit('hello', rev_id='rev2')
1022
 
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1023
 
        repo = self.make_repository('repo', format='dirstate-with-subtree')
1024
 
        bundle.install_revisions(repo)
1025
 
        inv = repo.get_inventory('rev2')
 
1029
        repo = self.make_repo_with_installed_revisions()
1026
1030
        self.assertEqual('rev2', inv.root.revision)
1027
1031
        root_vf = repo.weave_store.get_weave(inv.root.file_id,
1028
1032
                                             repo.get_transaction())
1029
1033
        self.assertEqual(root_vf.versions(), ['rev1', 'rev2'])
1030
1034
 
 
1035
    def test_inv_hash_across_serializers(self):
 
1036
        repo = self.make_repo_with_installed_revisions()
 
1037
        recorded_inv_sha1 = repo.get_inventory_sha1('rev2')
 
1038
        xml = repo.get_inventory_xml('rev2')
 
1039
        self.assertEqual(sha_string(xml), recorded_inv_sha1)
 
1040
 
1031
1041
    def test_across_models_incompatible(self):
1032
1042
        tree = self.make_simple_tree('dirstate-with-subtree')
1033
1043
        tree.commit('hello', rev_id='rev1')