def test_fetch_missing_text_other_location_fails(self): if not self.repository_format.supports_full_versioned_files: raise TestNotApplicable('Need full versioned files') source_tree = self.make_branch_and_tree('source') source = source_tree.branch.repository target = self.make_to_repository('target') # start by adding a file so the data knit for the file exists in # repositories that have specific files for each fileid. self.build_tree(['source/id']) source_tree.add(['id'], [b'id']) source_tree.commit('a', rev_id=b'a') # now we manually insert a revision with an inventory referencing # file 'id' at revision 'b', but we do not insert revision b. # this should ensure that the new versions of files are being checked # for during pull operations inv = source.get_inventory(b'a') source.lock_write() self.addCleanup(source.unlock) source.start_write_group() inv.get_entry(b'id').revision = b'b' inv.revision_id = b'b' sha1 = source.add_inventory(b'b', inv, [b'a']) rev = Revision(timestamp=0, timezone=None, committer="Foo Bar <*****@*****.**>", message="Message", inventory_sha1=sha1, revision_id=b'b') rev.parent_ids = [b'a'] source.add_revision(b'b', rev) self.disable_commit_write_group_paranoia(source) source.commit_write_group() try: self.assertRaises(errors.RevisionNotPresent, target.fetch, source) except errors.NoRoundtrippingSupport: raise TestNotApplicable('roundtripping not supported') self.assertFalse(target.has_revision(b'b'))
def setUp(self): self.reduceLockdirTimeout() super(TestReconcileWithIncorrectRevisionCache, self).setUp() t = self.get_transport() # we need a revision with two parents in the wrong order # which should trigger reinsertion. # and another with the first one correct but the other two not # which should not trigger reinsertion. # these need to be in different repositories so that we don't # trigger a reconcile based on the other case. # there is no api to construct a broken knit repository at # this point. if we ever encounter a bad graph in a knit repo # we should add a lower level api to allow constructing such cases. # first off the common logic: self.first_tree = self.make_branch_and_tree('wrong-first-parent') self.second_tree = self.make_branch_and_tree( 'reversed-secondary-parents') for t in [self.first_tree, self.second_tree]: t.commit('1', rev_id=b'1') uncommit(t.branch, tree=t) t.commit('2', rev_id=b'2') uncommit(t.branch, tree=t) t.commit('3', rev_id=b'3') uncommit(t.branch, tree=t) #second_tree = self.make_branch_and_tree('reversed-secondary-parents') # second_tree.pull(tree) # XXX won't copy the repo? repo_secondary = self.second_tree.branch.repository # now setup the wrong-first parent case repo = self.first_tree.branch.repository repo.lock_write() repo.start_write_group() inv = Inventory(revision_id=b'wrong-first-parent') inv.root.revision = b'wrong-first-parent' if repo.supports_rich_root(): root_id = inv.root.file_id repo.texts.add_lines((root_id, b'wrong-first-parent'), [], []) sha1 = repo.add_inventory(b'wrong-first-parent', inv, [b'2', b'1']) rev = Revision(timestamp=0, timezone=None, committer="Foo Bar <*****@*****.**>", message="Message", inventory_sha1=sha1, revision_id=b'wrong-first-parent') rev.parent_ids = [b'1', b'2'] repo.add_revision(b'wrong-first-parent', rev) repo.commit_write_group() repo.unlock() # now setup the wrong-secondary parent case repo = repo_secondary repo.lock_write() repo.start_write_group() inv = Inventory(revision_id=b'wrong-secondary-parent') inv.root.revision = b'wrong-secondary-parent' if repo.supports_rich_root(): root_id = inv.root.file_id repo.texts.add_lines((root_id, b'wrong-secondary-parent'), [], []) sha1 = repo.add_inventory( b'wrong-secondary-parent', inv, [b'1', b'3', b'2']) rev = Revision(timestamp=0, timezone=None, committer="Foo Bar <*****@*****.**>", message="Message", inventory_sha1=sha1, revision_id=b'wrong-secondary-parent') rev.parent_ids = [b'1', b'2', b'3'] repo.add_revision(b'wrong-secondary-parent', rev) repo.commit_write_group() repo.unlock()