From 282018b79cc8df078381097cb3aeb29ff56e83c6 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 2 Jun 2010 20:11:00 +0200 Subject: Added first design and frame for object database. In a first step, loose objects will be written using our utilities, and certain object retrieval functionality moves into the GitObjectDatabase which is used by the repo instance Added performance test for object database access, which shows quite respectable tree parsing performance, and okay blob access. Nonetheless, it will be hard to beat the c performance using a pure python implementation, but it can be a nice practice to write it anyway to allow more direct pack manipulations. Some could benefit from the ability to write packs as these can serve as local cache if alternates are used --- lib/git/errors.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'lib/git/errors.py') diff --git a/lib/git/errors.py b/lib/git/errors.py index f66fb528..ecb1c35b 100644 --- a/lib/git/errors.py +++ b/lib/git/errors.py @@ -8,19 +8,16 @@ Module containing all exceptions thrown througout the git package, """ class InvalidGitRepositoryError(Exception): - """ - Thrown if the given repository appears to have an invalid format. - """ + """ Thrown if the given repository appears to have an invalid format. """ + +class InvalidDBRoot(Exception): + """Thrown if an object database cannot be initialized at the given path""" class NoSuchPathError(OSError): - """ - Thrown if a path could not be access by the system. - """ + """ Thrown if a path could not be access by the system. """ class GitCommandError(Exception): - """ - Thrown if execution of the git command fails with non-zero status code. - """ + """ Thrown if execution of the git command fails with non-zero status code. """ def __init__(self, command, status, stderr=None): self.stderr = stderr self.status = status -- cgit v1.2.1 From 6f8ce8901e21587cd2320562df412e05b5ab1731 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 2 Jun 2010 23:53:29 +0200 Subject: added frame for object reading, including simple test --- lib/git/errors.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/git/errors.py') diff --git a/lib/git/errors.py b/lib/git/errors.py index ecb1c35b..956e007f 100644 --- a/lib/git/errors.py +++ b/lib/git/errors.py @@ -10,8 +10,14 @@ Module containing all exceptions thrown througout the git package, class InvalidGitRepositoryError(Exception): """ Thrown if the given repository appears to have an invalid format. """ -class InvalidDBRoot(Exception): +class ODBError(Exception): + """All errors thrown by the object database""" + +class InvalidDBRoot(ODBError): """Thrown if an object database cannot be initialized at the given path""" + +class BadObject(ODBError): + """The object with the given SHA does not exist""" class NoSuchPathError(OSError): """ Thrown if a path could not be access by the system. """ -- cgit v1.2.1 From 38d59fc8ccccae8882fa48671377bf40a27915a7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 3 Jun 2010 16:35:35 +0200 Subject: odb: implemented loose object streaming, which is impossible to do efficiently considering that it copies string buffers all the time --- lib/git/errors.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/git/errors.py') diff --git a/lib/git/errors.py b/lib/git/errors.py index 956e007f..d8a35e02 100644 --- a/lib/git/errors.py +++ b/lib/git/errors.py @@ -18,6 +18,9 @@ class InvalidDBRoot(ODBError): class BadObject(ODBError): """The object with the given SHA does not exist""" + +class BadObjectType(ODBError): + """The object had an unsupported type""" class NoSuchPathError(OSError): """ Thrown if a path could not be access by the system. """ -- cgit v1.2.1