~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Andrew Bennetts
  • Date: 2009-09-07 06:01:48 UTC
  • mto: (4634.6.27 2.0)
  • mto: This revision was merged to the branch mainline in revision 4680.
  • Revision ID: andrew.bennetts@canonical.com-20090907060148-dyh501273kh2tmfx
Give more precise BzrCheckErrors in _check_new_inventories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
591
591
        :returns: set of missing keys.  Note that not every missing key is
592
592
            guaranteed to be reported.
593
593
        """
594
 
        if getattr(self.repo, 'chk_bytes', None) is None:
595
 
            return set()
596
594
        # Ensure that all revisions added in this write group have:
597
595
        #   - corresponding inventories,
598
596
        #   - chk root entries for those inventories,
610
608
        missing_corresponding = set(new_revisions_keys)
611
609
        missing_corresponding.difference_update(corresponding_invs)
612
610
        if missing_corresponding:
613
 
            return [('inventories', key) for key in missing_corresponding]
 
611
            raise errors.BzrCheckError(
 
612
                "Repository %s missing inventories for new revisions %r "
 
613
                 % (self.repo, sorted(missing_corresponding)))
614
614
        # Are any chk root entries missing for any inventories?  This includes
615
615
        # any present parent inventories, which may be used when calculating
616
616
        # deltas for streaming.
640
640
            all_missing.update([('chk_bytes',) + key for key in missing])
641
641
        if all_missing:
642
642
            # Don't bother checking any further.
643
 
            return all_missing
 
643
            raise errors.BzrCheckError(
 
644
                "Repository %s missing keys %r for new revisions"
 
645
                 % (self.repo, sorted(all_missing)))
644
646
        chk_bytes_no_fallbacks = self.repo.chk_bytes.without_fallbacks()
645
647
        chk_bytes_no_fallbacks._search_key_func = \
646
648
            self.repo.chk_bytes._search_key_func
650
652
            for interesting_rec, interesting_map in chk_diff:
651
653
                pass
652
654
        except errors.NoSuchRevision, e:
653
 
            # XXX: missing chk record detected!
654
 
            #print str(e)
655
 
            return set([('something',)])
656
 
        return all_missing
 
655
            raise errors.BzrCheckError(
 
656
                "Repository %s missing chk node(s) for new revisions."
 
657
                % (self.repo,))
657
658
        
658
659
    def _execute_pack_operations(self, pack_operations,
659
660
                                 _packer_class=GCCHKPacker,