Comment 2 for bug 248540

Revision history for this message
Tom Cato Amundsen (tca) wrote : Re: bzr check fails because of ghost revision

The patch below seems to work. But I don't understand bzr internals, so I cannot say if this is correct. I compared the output of "bzr selftest" before and after applying this, and it does not break any new tests.

=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py 2008-07-14 16:16:48 +0000
+++ bzrlib/repository.py 2008-07-15 21:25:40 +0000
@@ -1592,7 +1592,10 @@
             # RevisionNotPresent here until we see a use for it, because of the
             # cost in an inner loop that is by its very nature O(history).
             # Robert Collins 20080326
- parents = graph.get_parent_map([next_id])[next_id]
+ try:
+ parents = graph.get_parent_map([next_id])[next_id]
+ except KeyError:
+ raise errors.RevisionNotPresent(next_id, self)
             if len(parents) == 0:
                 return
             else: