181
181
def _import_one_rev(self, rev_id):
182
182
"""Convert rev_id and all referenced file texts to new format."""
183
inv_xml = self.branch.inventory_store[rev_id].read()
184
inv = serializer_v4.read_inventory_from_string(inv_xml)
183
old_inv_xml = self.branch.inventory_store[rev_id].read()
184
inv = serializer_v4.read_inventory_from_string(old_inv_xml)
185
new_inv_xml = serializer_v5.write_inventory_to_string(inv)
185
186
inv_parents = [x for x in self.revisions[rev_id].parent_ids
186
187
if x not in self.absent_revisions]
187
188
self.inv_weave.add(rev_id, inv_parents,
188
inv_xml.splitlines(True))
189
new_inv_xml.splitlines(True))
191
192
def _make_order(self):
214
def _convert_one_rev(self, rev_id):
215
self._bump_progress()
218
if rev_id not in b.revision_store:
220
note('revision {%s} not present in branch; '
221
'will not be converted',
223
self.absent_revisions.add(rev_id)
226
rev_xml = b.revision_store[rev_id].read()
227
inv_xml = b.inventory_store[rev_id].read()
229
rev = serializer_v4.read_revision_from_string(rev_xml)
230
inv = serializer_v4.read_inventory_from_string(inv_xml)
232
self.converted_revs.add(rev_id)
234
return ##########################################
236
tree = b.revision_tree(rev_id)
239
# for each file in the inventory, put it into its own revfile
242
if ie.kind != 'file':
244
if last_text_sha.get(file_id) == ie.text_sha1:
247
last_text_sha[file_id] = ie.text_sha1
249
# new text (though possibly already stored); need to store it
250
text_lines = tree.get_file(file_id).readlines()
252
# if the file's created for the first time in this
253
# revision then make a new weave; else find the old one
254
if file_id not in text_weaves:
255
text_weaves[file_id] = Weave()
257
w = text_weaves[file_id]
259
# base the new text version off whatever was last
260
# (actually it'd be better to track this, to allow for
261
# files that are deleted and then reappear)
268
w.add(rev_id, parents, text_lines)
275
215
def write_atomic_weave(weave, filename):
276
216
inv_wf = AtomicFile(filename)