[MERGE/RFC] Reconcile now rewrites inventory sha1sums
Ian Clatworthy
ian.clatworthy at internode.on.net
Mon May 19 08:36:04 BST 2008
Aaron Bentley wrote:
> This patch updates reconcile to rewrite inventory sha1 sums, which
> Robert has identified as a prerequisite to making rich-root-pack our
> default format.
bb:tweak
> + def _fix_inventory_sha1s(self):
> + """Copy revision texts and update their inventory sha1s."""
> + def replace_revision(revision_id, parent_ids, lines):
> + store = self.repo._revision_store.text_store
> + for name in store._id_to_names(revision_id, None):
> + try:
> + store._transport.delete(name)
> + except errors.NoSuchFile:
> + pass
> + revision_file = StringIO(''.join(lines))
> + store.add(revision_file, revision_id)
> + _rewrite_inventory_sha1s(self.repo, replace_revision)
I'd appreciate it if someone else more familiar with pre-knit formats
reviewed this block of code. John perhaps?
> + base_index = getattr(self.new_pack, index_name + '_index')
> + if file_id is not None:
> + index = GraphIndexPrefixAdapter(
> + base_index,
> + (file_id, ), 1,
> + add_nodes_callback=base_index.add_nodes)
> + else:
> + index = base_index
> + knit_index = KnitGraphIndex(index,
> + add_callback=index.add_nodes,
> + deltas=deltas, parents=parents)
> + return knit.KnitVersionedFile('reconcile-revisions',
I think you want ...
'reconcile %ss' % (index_name,)
there instead of 'reconcile-revisions'.
> + self._pack_collection.transport,
> + index=knit_index,
> + delta=deltas,
> + access_method=_PackAccess(
> + {base_index:self.new_pack.access_tuple()},
> + (self.new_pack._writer, index)),
Did you mean ...
{index:...
instead of {base_index:... there?
Otherwise, looks good to me.
Ian C.
More information about the bazaar
mailing list