summaryrefslogtreecommitdiff
path: root/gitdb/db
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-11-13 18:31:17 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-11-13 18:31:17 +0100
commit641b64c9f48139cf06774805d32892012fb9b82d (patch)
tree144b400955067f0d4297fb06d2af6c58eac2cfb1 /gitdb/db
parentbf942a913d69eb2079f9e82888aaccf2f6222643 (diff)
downloadgitdb-641b64c9f48139cf06774805d32892012fb9b82d.tar.gz
Now tests work consistently in py2 and 3
It's a nice way of saying that there is still one failing, consistently.
Diffstat (limited to 'gitdb/db')
-rw-r--r--gitdb/db/base.py7
-rw-r--r--gitdb/db/loose.py2
2 files changed, 4 insertions, 5 deletions
diff --git a/gitdb/db/base.py b/gitdb/db/base.py
index eac54ec..a670eea 100644
--- a/gitdb/db/base.py
+++ b/gitdb/db/base.py
@@ -9,6 +9,7 @@ from gitdb.util import (
hex_to_bin
)
+from gitdb.utils.encoding import force_text
from gitdb.exc import (
BadObject,
AmbiguousObjectName
@@ -122,8 +123,6 @@ class FileDBBase(object):
"""
:return: the given relative path relative to our database root, allowing
to pontentially access datafiles"""
- from gitdb.utils.encoding import force_text
-
return join(self._root_path, force_text(rela_path))
#} END interface
@@ -234,12 +233,12 @@ class CompoundDB(ObjectDBR, LazyMixin, CachingDB):
def partial_to_complete_sha_hex(self, partial_hexsha):
"""
- :return: 20 byte binary sha1 from the given less-than-40 byte hexsha
+ :return: 20 byte binary sha1 from the given less-than-40 byte hexsha (bytes or str)
:param partial_hexsha: hexsha with less than 40 byte
:raise AmbiguousObjectName: """
databases = list()
_databases_recursive(self, databases)
-
+ partial_hexsha = force_text(partial_hexsha)
len_partial_hexsha = len(partial_hexsha)
if len_partial_hexsha % 2 != 0:
partial_binsha = hex_to_bin(partial_hexsha + "0")
diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py
index 3abdaa9..3743026 100644
--- a/gitdb/db/loose.py
+++ b/gitdb/db/loose.py
@@ -109,7 +109,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW):
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
+ :param name: hexadecimal partial name (bytes or ascii string)
:raise AmbiguousObjectName:
:raise BadObject: """
candidate = None