79
79
def __init__(self, to_repository, from_repository, last_revision=None, pb=None,
80
find_ghosts=True, _write_group_acquired_callable=None):
81
81
"""Create a repo fetcher.
83
83
:param find_ghosts: If True search the entire history for ghosts.
84
:param _write_group_acquired_callable: Don't use; this parameter only
85
exists to facilitate a hack done in InterPackRepo.fetch. We would
86
like to remove this parameter.
85
88
# result variables.
86
89
self.failed_revisions = []
95
98
# must not mutate self._last_revision as its potentially a shared instance
96
99
self._last_revision = last_revision
97
100
self.find_ghosts = find_ghosts
101
self._write_group_acquired_callable = _write_group_acquired_callable
99
103
self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
100
104
self.nested_pb = self.pb
108
112
self.to_repository.start_write_group()
114
if self._write_group_acquired_callable is not None:
115
# Used by InterPackRepo.fetch to set_write_cache_size
117
self._write_group_acquired_callable()
112
self.to_repository.abort_write_group()
120
self.to_repository.abort_write_group(suppress_errors=True)
115
123
self.to_repository.commit_write_group()
248
256
child_pb.finished()
250
258
def _fetch_revision_texts(self, revs, pb):
259
# fetch signatures first and then the revision texts
251
260
# may need to be a InterRevisionStore call here.
252
261
to_sf = self.to_repository.signatures
253
262
from_sf = self.from_repository.signatures
255
264
to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
256
265
[(rev_id,) for rev_id in revs],
257
266
self.to_repository._fetch_order,
259
# Bug #261339, some knit repositories accidentally had deltas in their
260
# revision stream, when you weren't ever supposed to have deltas.
261
# So we now *force* fulltext copying for signatures and revisions
267
not self.to_repository._fetch_uses_deltas)))
262
268
self._fetch_just_revision_texts(revs)
264
270
def _fetch_just_revision_texts(self, version_ids):
265
271
to_rf = self.to_repository.revisions
266
272
from_rf = self.from_repository.revisions
273
# If a revision has a delta, this is actually expanded inside the
274
# insert_record_stream code now, which is an alternate fix for
267
276
to_rf.insert_record_stream(from_rf.get_record_stream(
268
277
[(rev_id,) for rev_id in version_ids],
269
278
self.to_repository._fetch_order,
271
# Bug #261339, some knit repositories accidentally had deltas in their
272
# revision stream, when you weren't ever supposed to have deltas.
273
# So we now *force* fulltext copying for signatures and revisions
279
not self.to_repository._fetch_uses_deltas))
275
281
def _generate_root_texts(self, revs):
276
282
"""This will be called by __fetch between fetching weave texts and