diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2011-06-06 18:59:46 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2011-06-06 18:59:46 +0200 |
commit | 47f14d527f61d30ffa49a6254838ca5c1aee3972 (patch) | |
tree | 896a5e74082bdd36226bdd5e68b410949c955234 /git/db/py/loose.py | |
parent | 155158e1410ff036812a87975cce6cb91aa8280e (diff) | |
download | gitpython-47f14d527f61d30ffa49a6254838ca5c1aee3972.tar.gz |
Added loose object writing and reading performance tessts, in pure and command implementations. The previous performance test was truncated a bit as it compared directly with the git hash_object write performance. This is out, and if we wanted it we could implement it , but its actually slower for us
Diffstat (limited to 'git/db/py/loose.py')
-rw-r--r-- | git/db/py/loose.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/git/db/py/loose.py b/git/db/py/loose.py index 56915f18..6e72aff0 100644 --- a/git/db/py/loose.py +++ b/git/db/py/loose.py @@ -107,22 +107,6 @@ class PureLooseObjectODB(PureRootPathDB, PureObjectDBR, PureObjectDBW): # END handle cache raise BadObject(hexsha) - def partial_to_complete_sha_hex(self, partial_hexsha): - """:return: 20 byte binary sha1 string which matches the given name uniquely - :param name: hexadecimal partial name - :raise AmbiguousObjectName: - :raise BadObject: """ - candidate = None - for binsha in self.sha_iter(): - if bin_to_hex(binsha).startswith(partial_hexsha): - # it can't ever find the same object twice - if candidate is not None: - raise AmbiguousObjectName(partial_hexsha) - candidate = binsha - # END for each object - if candidate is None: - raise BadObject(partial_hexsha) - return candidate #} END interface @@ -179,6 +163,23 @@ class PureLooseObjectODB(PureRootPathDB, PureObjectDBR, PureObjectDBW): except BadObject: return False # END check existance + + def partial_to_complete_sha_hex(self, partial_hexsha): + """:return: 20 byte binary sha1 string which matches the given name uniquely + :param name: hexadecimal partial name + :raise AmbiguousObjectName: + :raise BadObject: """ + candidate = None + for binsha in self.sha_iter(): + if bin_to_hex(binsha).startswith(partial_hexsha): + # it can't ever find the same object twice + if candidate is not None: + raise AmbiguousObjectName(partial_hexsha) + candidate = binsha + # END for each object + if candidate is None: + raise BadObject(partial_hexsha) + return candidate def store(self, istream): """note: The sha we produce will be hex by nature""" |