Add check() methods to object classes for consistency checking.
authorDave Borowitz <dborowitz@google.com>
Thu, 8 Apr 2010 00:55:09 +0000 (02:55 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 8 Apr 2010 00:55:09 +0000 (02:55 +0200)
commitddede6e4a7343003f6121938c2a6ea322e9adbb6
treeefcb3e27da18f4aa10383981941791e869066d47
parent804f545d4b0fa99bf685f8f9461b93b92871668f
Add check() methods to object classes for consistency checking.

These roughly mirror the parts of git fsck that deal with object
well-formedness, including checking the presence of required headers,
formatting of author/committer names, tree ordering, and so on. This
change does *not* include consistency checks that require touching other
objects; those will go in ObjectStore.

Note that currently many types of errors will still be raised during
object parsing proper, such as ValueErrors when trying to parse invalid
integers. In the check() method, any such exceptions are caught and
wrapped in an ObjectFormatException. The separate codepath also gives
us a place to put these checks if we decide to optimize them out of the
main object-parsing codepath.
dulwich/_objects.c
dulwich/errors.py
dulwich/objects.py
dulwich/tests/test_objects.py