155
160
file_ids = self.from_repository.fileid_involved_by_set(revs)
157
162
num_file_ids = len(file_ids)
158
for file_id in file_ids:
159
self.pb.update("merge weaves", count, num_file_ids)
161
to_weave = self.to_weaves.get_weave_or_empty(file_id,
162
self.to_repository.get_transaction())
163
pb = bzrlib.ui.ui_factory.nested_progress_bar()
165
for file_id in file_ids:
166
pb.update("merge weaves", count, num_file_ids)
168
to_weave = self.to_weaves.get_weave_or_empty(file_id,
169
self.to_repository.get_transaction())
164
if to_weave.num_versions() > 0:
165
# destination has contents, must merge
166
from_weave = self.from_weaves.get_weave(file_id,
167
self.from_repository.get_transaction())
168
# we fetch all the texts, because texts do
169
# not reference anything, and its cheap enough
170
to_weave.join(from_weave)
172
# destination is empty, just replace it
173
self.to_weaves.copy_multi(self.from_weaves, [file_id], self.pb,
174
self.from_repository.get_transaction(),
175
self.to_repository.get_transaction())
171
if to_weave.num_versions() > 0:
172
# destination has contents, must merge
173
from_weave = self.from_weaves.get_weave(file_id,
174
self.from_repository.get_transaction())
175
# we fetch all the texts, because texts do
176
# not reference anything, and its cheap enough
177
to_weave.join(from_weave)
179
# destination is empty, just replace it
181
child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
182
from_repo = self.from_repository
183
from_transaction = from_repo.get_transaction()
184
to_transaction = self.to_repository.get_transaction()
185
self.to_weaves.copy_multi(self.from_weaves, [file_id],
186
child_pb, from_transaction,
178
193
def _fetch_inventory_weave(self, revs):
179
self.pb.update("inventory fetch", 0, 2)
180
to_weave = self.to_control.get_weave('inventory',
181
self.to_repository.get_transaction())
183
if to_weave.num_versions() > 0:
184
# destination has contents, must merge
185
self.pb.update("inventory fetch", 1, 2)
186
from_weave = self.from_repository.get_inventory_weave()
187
self.pb.update("inventory fetch", 2, 2)
188
# we fetch only the referenced inventories because we do not
189
# know for unselected inventories whether all their required
190
# texts are present in the other repository - it could be
192
to_weave.join(from_weave, pb=self.pb, msg='merge inventory',
195
# destination is empty, just replace it
196
self.to_control.copy_multi(self.from_control,
199
self.from_repository.get_transaction(),
200
self.to_repository.get_transaction())
194
pb = bzrlib.ui.ui_factory.nested_progress_bar()
196
pb.update("inventory fetch", 0, 3)
197
to_weave = self.to_control.get_weave('inventory',
198
self.to_repository.get_transaction())
200
child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
202
if to_weave.num_versions() > 0:
203
# destination has contents, must merge
204
pb.update("inventory fetch", 1, 3)
205
from_weave = self.from_repository.get_inventory_weave()
206
pb.update("inventory fetch", 2, 3)
207
# we fetch only the referenced inventories because we do not
208
# know for unselected inventories whether all their required
209
# texts are present in the other repository - it could be
211
to_weave.join(from_weave, pb=child_pb,
212
msg='merge inventory', version_ids=revs)
214
# destination is empty, just replace it
215
from_transaction = self.from_repository.get_transaction()
216
to_transaction = self.to_repository.get_transaction()
217
self.to_control.copy_multi(self.from_control,
205
228
class GenericRepoFetcher(RepoFetcher):
213
236
self.to_transaction = self.to_repository.get_transaction()
215
238
total = len(revs)
217
self.pb.update('copying revisions', count, total)
219
sig_text = self.from_repository.get_signature_text(rev)
220
self.to_repository._revision_store.add_revision_signature_text(
221
rev, sig_text, self.to_transaction)
222
except errors.NoSuchRevision:
225
self.to_repository._revision_store.add_revision(
226
self.from_repository.get_revision(rev),
229
self.pb.update('copying revisions', count, total)
239
pb = bzrlib.ui.ui_factory.nested_progress_bar()
242
pb.update('copying revisions', count, total)
244
sig_text = self.from_repository.get_signature_text(rev)
245
store = self.to_repository._revision_store
246
store.add_revision_signature_text(rev, sig_text,
248
except errors.NoSuchRevision:
251
self.to_repository._revision_store.add_revision(
252
self.from_repository.get_revision(rev),
255
pb.update('copying revisions', count, total)
230
258
# fixup inventory if needed:
231
259
# this is expensive because we have no inverse index to current ghosts.
232
260
# but on local disk its a few seconds and sftp push is already insane.