]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-remote-testgit.py
Makefile: Add cover_db target
[thirdparty/git.git] / git-remote-testgit.py
index 92539222c57d1966f847a641c976754f1941dc2b..df9d512f1a966635828cb7a8dadde3b0c2b7b9d8 100644 (file)
@@ -1,6 +1,12 @@
 #!/usr/bin/env python
 
-import hashlib
+# hashlib is only available in python >= 2.5
+try:
+    import hashlib
+    _digest = hashlib.sha1
+except ImportError:
+    import sha
+    _digest = sha.new
 import sys
 import os
 sys.path.insert(0, os.getenv("GITPYTHONLIB","."))
@@ -19,7 +25,7 @@ def get_repo(alias, url):
     repo.get_revs()
     repo.get_head()
 
-    hasher = hashlib.sha1()
+    hasher = _digest()
     hasher.update(repo.path)
     repo.hash = hasher.hexdigest()
 
@@ -133,7 +139,10 @@ def do_export(repo, args):
 
     path = os.path.join(dirname, 'testgit.marks')
     print path
-    print path if os.path.exists(path) else ""
+    if os.path.exists(path):
+        print path
+    else:
+        print ""
     sys.stdout.flush()
 
     update_local_repo(repo)