Comment 6 for bug 655371

Revision history for this message
Vincent Ladeuil (vila) wrote :

I hope we don't have anything in the indexes that can't be recreated from the packs...

Anyway, about the empty pack files, here is a very crude script (you need to edit it to be able to use it in your case) that we should polish and include in bzr:

#!/usr/bin/env python
"""Repair a repo with an empty pack file.
"""

from bzrlib import repository, btree_index, transport

t = transport.get_transport('/repo/.bzr/repository')
pn_index = btree_index.BTreeGraphIndex(t, 'pack-names', None)
nodes = pn_index.iter_all_entries()

new_index = btree_index.BTreeBuilder(0, 1)

for _, key, value in nodes:
  if key == ('128bb4cf175c5a51a7c4802f09d55b8d',):
    continue
  new_index.add_node(key, value)

new_index_content = new_index.finish()
t.put_file('pack-names', new_index_content)