48
50
"%s isn't a knit format" % self.repository_format)
50
52
repo = self.make_repository('broken')
51
inv = inventory.Inventory(revision_id='revision-id')
52
inv.root.revision = 'revision-id'
53
repo.add_inventory('revision-id', inv, [])
54
revision = _mod_revision.Revision('revision-id',
55
committer='jrandom@example.com', timestamp=0,
56
inventory_sha1='', timezone=0, message='message', parent_ids=[])
57
repo.add_revision('revision-id',revision, inv)
54
repo.start_write_group()
56
inv = inventory.Inventory(revision_id='revision-id')
57
inv.root.revision = 'revision-id'
58
inv_sha1 = repo.add_inventory('revision-id', inv, [])
59
if repo.supports_rich_root():
60
root_id = inv.root.file_id
61
vf = repo.weave_store.get_weave_or_empty(root_id,
62
repo.get_transaction())
63
vf.add_lines('revision-id', [], [])
64
revision = _mod_revision.Revision('revision-id',
65
committer='jrandom@example.com', timestamp=0,
66
inventory_sha1=inv_sha1, timezone=0, message='message',
68
# Manually add the revision text using the RevisionStore API, with
71
repo._revision_store._serializer.write_revision(revision, rev_tmp)
73
repo._revision_store.get_revision_file(repo.get_transaction()
74
).add_lines_with_ghosts(revision.revision_id,
76
osutils.split_lines(rev_tmp.read()))
78
repo.abort_write_group()
82
repo.commit_write_group()
59
# Change the knit index's record of the parents for 'revision-id' to
60
# claim it has a parent, 'incorrect-parent', that doesn't exist in this
63
86
self.addCleanup(repo.unlock)
64
rev_knit = repo._get_revision_vf()
65
index_cache = rev_knit._index._cache
66
cached_index_entry = list(index_cache['revision-id'])
67
cached_index_entry[4] = ['incorrect-parent']
68
index_cache['revision-id'] = tuple(cached_index_entry)