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 (
1015
1015
self.assertNotContainsRe(inv_text, 'format="5"')
1016
1016
self.assertContainsRe(inv_text, 'format="7"')
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)
1018
1027
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)
1028
repo = self.make_repo_with_installed_revisions()
1025
1029
inv = repo.get_inventory('rev2')
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'])
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)
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')