34
34
import bzrlib.errors as errors
35
from bzrlib.errors import (InstallFailed, NoSuchRevision, WeaveError,
35
from bzrlib.errors import (InstallFailed, NoSuchRevision,
37
37
from bzrlib.trace import mutter
38
38
from bzrlib.progress import ProgressBar
161
161
to_weave = self.to_weaves.get_weave_or_empty(file_id,
162
162
self.to_repository.get_transaction())
163
from_weave = self.from_weaves.get_weave(file_id,
164
self.from_repository.get_transaction())
166
164
if to_weave.numversions() > 0:
167
165
# destination has contents, must merge
166
from_weave = self.from_weaves.get_weave(file_id,
167
self.from_repository.get_transaction())
169
169
to_weave.join(from_weave)
170
170
except errors.WeaveParentMismatch:
171
171
to_weave.reweave(from_weave)
173
173
# destination is empty, just replace it
174
to_weave = from_weave.copy()
176
self.to_weaves.put_weave(file_id, to_weave,
177
self.to_repository.get_transaction())
174
self.to_weaves.copy_multi(self.from_weaves, [file_id], self.pb)
180
177
def _fetch_inventory_weave(self, revs):
181
178
self.pb.update("inventory fetch", 0, 2)
182
from_weave = self.from_repository.get_inventory_weave()
183
to_weave = self.to_repository.get_inventory_weave()
184
self.pb.update("inventory fetch", 1, 2)
185
179
to_weave = self.to_control.get_weave('inventory',
186
180
self.to_repository.get_transaction())
187
self.pb.update("inventory fetch", 2, 2)
189
182
if to_weave.numversions() > 0:
190
183
# destination has contents, must merge
184
self.pb.update("inventory fetch", 1, 2)
185
from_weave = self.from_repository.get_inventory_weave()
186
self.pb.update("inventory fetch", 2, 2)
192
188
to_weave.join(from_weave, pb=self.pb, msg='merge inventory')
193
189
except errors.WeaveParentMismatch:
194
190
to_weave.reweave(from_weave, pb=self.pb, msg='reweave inventory')
196
192
# destination is empty, just replace it
197
to_weave = from_weave.copy()
199
self.to_control.put_weave('inventory', to_weave,
200
self.to_repository.get_transaction())
193
self.to_control.copy_multi(self.from_control,
196
self.from_repository.get_transaction())