169
169
# not reference anything, and its cheap enough
170
170
to_weave.join(from_weave)
172
# destination is empty, just replace it
172
# destination is empty, just copy it.
173
# this copies all the texts, which is useful and
174
# on per-file basis quite cheap.
173
175
self.to_weaves.copy_multi(self.from_weaves, [file_id], self.pb,
174
176
self.from_repository.get_transaction(),
175
177
self.to_repository.get_transaction())
180
182
to_weave = self.to_control.get_weave('inventory',
181
183
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())
185
# just merge, this is optimisable and its means we dont
186
# copy unreferenced data such as not-needed inventories.
187
self.pb.update("inventory fetch", 1, 2)
188
from_weave = self.from_repository.get_inventory_weave()
189
self.pb.update("inventory fetch", 2, 2)
190
# we fetch only the referenced inventories because we do not
191
# know for unselected inventories whether all their required
192
# texts are present in the other repository - it could be
194
to_weave.join(from_weave, pb=self.pb, msg='merge inventory',
232
226
# but on local disk its a few seconds and sftp push is already insane.
233
227
# so we just-do-it.
234
228
# FIXME: repository should inform if this is needed.
235
reconciler = RepoReconciler(self.to_repository)
236
reconciler.reconcile()
229
self.to_repository.reconcile()
239
232
class KnitRepoFetcher(RepoFetcher):