diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-06-12 17:20:43 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-06-12 17:20:43 +0200 |
commit | 6c1faef799095f3990e9970bc2cb10aa0221cf9c (patch) | |
tree | a79a69fa46df39eb794875f374b74110dfe091e1 /lib/git/utils.py | |
parent | 86ea63504f3e8a74cfb1d533be9d9602d2d17e27 (diff) | |
download | gitpython-6c1faef799095f3990e9970bc2cb10aa0221cf9c.tar.gz |
Removed odb from project, it is now used as a submodule named gitdb, which was added instead
Adjusted all imports to deal with the changed package names
Diffstat (limited to 'lib/git/utils.py')
-rw-r--r-- | lib/git/utils.py | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/lib/git/utils.py b/lib/git/utils.py index 60a7de48..ab763a10 100644 --- a/lib/git/utils.py +++ b/lib/git/utils.py @@ -9,38 +9,11 @@ import sys import time import tempfile -try: - import hashlib -except ImportError: - import sha +from gitdb.util import ( + stream_copy, + make_sha + ) -def make_sha(source=''): - """ - A python2.4 workaround for the sha/hashlib module fiasco - - Note - From the dulwich project - """ - try: - return hashlib.sha1(source) - except NameError: - sha1 = sha.sha(source) - return sha1 - -def stream_copy(source, destination, chunk_size=512*1024): - """Copy all data from the source stream into the destination stream in chunks - of size chunk_size - :return: amount of bytes written""" - br = 0 - while True: - chunk = source.read(chunk_size) - destination.write(chunk) - br += len(chunk) - if len(chunk) < chunk_size: - break - # END reading output stream - return br - def join_path(a, *p): """Join path tokens together similar to os.path.join, but always use |