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 (
1014
1014
self.assertNotContainsRe(inv_text, 'format="5"')
1015
1015
self.assertContainsRe(inv_text, 'format="7"')
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)
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'])
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)
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')