73
75
repo_b = self.make_to_repository('b')
74
76
check_push_rev1(repo_b)
78
def test_fetch_inconsistent_last_changed_entries(self):
79
"""If an inventory has odd data we should still get what it references.
81
This test tests that we do fetch a file text created in a revision not
82
being fetched, but referenced from the revision we are fetching when the
83
adjacent revisions to the one being fetched do not reference that text.
85
tree = self.make_branch_and_tree('source')
86
revid = tree.commit('old')
87
to_repo = self.make_to_repository('to_repo')
88
to_repo.fetch(tree.branch.repository, revid)
89
# Make a broken revision and fetch it.
90
source = tree.branch.repository
92
self.addCleanup(source.unlock)
93
source.start_write_group()
95
# We need two revisions: OLD and NEW. NEW will claim to need a file
96
# 'FOO' changed in 'OLD'. OLD will not have that file at all.
97
source.texts.insert_record_stream([
98
versionedfile.FulltextContentFactory(('foo', revid), (), None,
100
basis = source.revision_tree(revid)
101
parent_id = basis.path2id('')
102
entry = inventory.make_entry('file', 'foo-path', parent_id, 'foo')
103
entry.revision = revid
104
entry.text_size = len('contents')
105
entry.text_sha1 = osutils.sha_string('contents')
106
inv_sha1, _ = source.add_inventory_by_delta(revid, [
107
(None, 'foo-path', 'foo', entry)], 'new', [revid])
108
rev = Revision(timestamp=0,
110
committer="Foo Bar <foo@example.com>",
112
inventory_sha1=inv_sha1,
115
source.add_revision(rev.revision_id, rev)
117
source.abort_write_group()
120
source.commit_write_group()
121
to_repo.fetch(source, 'new')
123
self.addCleanup(to_repo.unlock)
124
self.assertEqual('contents',
125
to_repo.texts.get_record_stream([('foo', revid)],
126
'unordered', True).next().get_bytes_as('fulltext'))
76
128
def test_fetch_missing_basis_text(self):
77
129
"""If fetching a delta, we should die if a basis is not present."""
78
130
tree = self.make_branch_and_tree('tree')