~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Martin Pool
  • Date: 2008-05-08 04:33:38 UTC
  • mfrom: (3414 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080508043338-ru3vflx8z641a76k
Merge trunk

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,
1014
1014
        self.assertNotContainsRe(inv_text, 'format="5"')
1015
1015
        self.assertContainsRe(inv_text, 'format="7"')
1016
1016
 
 
1017
    def make_repo_with_installed_revisions(self):
 
1018
        tree = self.make_simple_tree('knit')
 
1019
        tree.commit('hello', rev_id='rev1')
 
1020
        tree.commit('hello', rev_id='rev2')
 
1021
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
 
1022
        repo = self.make_repository('repo', format='dirstate-with-subtree')
 
1023
        bundle.install_revisions(repo)
 
1024
        return repo
 
1025
 
1017
1026
    def test_across_models(self):
1018
 
        tree = self.make_simple_tree('knit')
1019
 
        tree.commit('hello', rev_id='rev1')
1020
 
        tree.commit('hello', rev_id='rev2')
1021
 
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1022
 
        repo = self.make_repository('repo', format='dirstate-with-subtree')
1023
 
        bundle.install_revisions(repo)
 
1027
        repo = self.make_repo_with_installed_revisions()
1024
1028
        inv = repo.get_inventory('rev2')
1025
1029
        self.assertEqual('rev2', inv.root.revision)
1026
1030
        root_vf = repo.weave_store.get_weave(inv.root.file_id,
1027
1031
                                             repo.get_transaction())
1028
1032
        self.assertEqual(root_vf.versions(), ['rev1', 'rev2'])
1029
1033
 
 
1034
    def test_inv_hash_across_serializers(self):
 
1035
        repo = self.make_repo_with_installed_revisions()
 
1036
        recorded_inv_sha1 = repo.get_inventory_sha1('rev2')
 
1037
        xml = repo.get_inventory_xml('rev2')
 
1038
        self.assertEqual(sha_string(xml), recorded_inv_sha1)
 
1039
 
1030
1040
    def test_across_models_incompatible(self):
1031
1041
        tree = self.make_simple_tree('dirstate-with-subtree')
1032
1042
        tree.commit('hello', rev_id='rev1')