157
155
raise InstallFailed([self._last_revision])
159
157
def _fetch_weave_texts(self, revs):
160
file_ids = self.from_repository.fileid_involved_by_set(revs)
162
num_file_ids = len(file_ids)
163
pb = bzrlib.ui.ui_factory.nested_progress_bar()
158
texts_pb = bzrlib.ui.ui_factory.nested_progress_bar()
160
file_ids = self.from_repository.fileid_involved_by_set(revs)
162
num_file_ids = len(file_ids)
165
163
for file_id in file_ids:
166
pb.update("merge weaves", count, num_file_ids)
164
texts_pb.update("fetch texts", count, num_file_ids)
168
to_weave = self.to_weaves.get_weave_or_empty(file_id,
169
self.to_repository.get_transaction())
171
if to_weave.num_versions() > 0:
167
to_weave = self.to_weaves.get_weave(file_id,
168
self.to_repository.get_transaction())
169
except errors.NoSuchFile:
170
# destination is empty, just copy it.
171
# this copies all the texts, which is useful and
172
# on per-file basis quite cheap.
173
self.to_weaves.copy_multi(
177
self.from_repository.get_transaction(),
178
self.to_repository.get_transaction())
172
180
# destination has contents, must merge
173
181
from_weave = self.from_weaves.get_weave(file_id,
174
182
self.from_repository.get_transaction())
175
183
# we fetch all the texts, because texts do
176
184
# not reference anything, and its cheap enough
177
185
to_weave.join(from_weave)
179
# destination is empty, just copy it.
180
# this copies all the texts, which is useful and
181
# on per-file basis quite cheap.
182
child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
184
from_repo = self.from_repository
185
from_transaction = from_repo.get_transaction()
186
to_transaction = self.to_repository.get_transaction()
187
self.to_weaves.copy_multi(self.from_weaves, [file_id],
188
child_pb, from_transaction,
195
189
def _fetch_inventory_weave(self, revs):
196
190
pb = bzrlib.ui.ui_factory.nested_progress_bar()
198
pb.update("inventory fetch", 0, 3)
192
pb.update("fetch inventory", 0, 2)
199
193
to_weave = self.to_control.get_weave('inventory',
200
194
self.to_repository.get_transaction())
202
196
child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
204
198
# just merge, this is optimisable and its means we dont
205
199
# copy unreferenced data such as not-needed inventories.
206
pb.update("inventory fetch", 1, 3)
200
pb.update("fetch inventory", 1, 3)
207
201
from_weave = self.from_repository.get_inventory_weave()
208
pb.update("inventory fetch", 2, 3)
202
pb.update("fetch inventory", 2, 3)
209
203
# we fetch only the referenced inventories because we do not
210
204
# know for unselected inventories whether all their required
211
205
# texts are present in the other repository - it could be
228
222
def _fetch_revision_texts(self, revs):
229
self.to_transaction = self.to_repository.get_transaction()
232
pb = bzrlib.ui.ui_factory.nested_progress_bar()
223
"""Fetch revision object texts"""
224
rev_pb = bzrlib.ui.ui_factory.nested_progress_bar()
226
to_txn = self.to_transaction = self.to_repository.get_transaction()
229
to_store = self.to_repository._revision_store
235
pb.update('copying revisions', count, total)
231
pb = bzrlib.ui.ui_factory.nested_progress_bar()
237
sig_text = self.from_repository.get_signature_text(rev)
238
store = self.to_repository._revision_store
239
store.add_revision_signature_text(rev, sig_text,
241
except errors.NoSuchRevision:
244
self.to_repository._revision_store.add_revision(
245
self.from_repository.get_revision(rev),
248
pb.update('copying revisions', count, total)
233
pb.update('copying revisions', count, total)
235
sig_text = self.from_repository.get_signature_text(rev)
236
to_store.add_revision_signature_text(rev, sig_text, to_txn)
237
except errors.NoSuchRevision:
240
to_store.add_revision(self.from_repository.get_revision(rev),
245
# fixup inventory if needed:
246
# this is expensive because we have no inverse index to current ghosts.
247
# but on local disk its a few seconds and sftp push is already insane.
249
# FIXME: repository should inform if this is needed.
250
self.to_repository.reconcile()
251
# fixup inventory if needed:
252
# this is expensive because we have no inverse index to current ghosts.
253
# but on local disk its a few seconds and sftp push is already insane.
255
# FIXME: repository should inform if this is needed.
256
self.to_repository.reconcile()
259
255
class KnitRepoFetcher(RepoFetcher):
273
269
from_sf = self.from_repository._revision_store.get_signature_file(
274
270
from_transaction)
275
to_sf.join(from_sf, version_ids=revs, pb=self.pb, ignore_missing=True)
271
to_sf.join(from_sf, version_ids=revs, ignore_missing=True)
276
272
to_rf = self.to_repository._revision_store.get_revision_file(
278
274
from_rf = self.from_repository._revision_store.get_revision_file(
279
275
from_transaction)
280
to_rf.join(from_rf, version_ids=revs, pb=self.pb)
276
to_rf.join(from_rf, version_ids=revs)
283
279
class Fetcher(object):