import re, sys
from bup import git, vint
-from bup.compat import hexstr, pending_raise, str_type
+from bup.compat import hexstr, pending_raise
from bup.git import BUP_CHUNKED, parse_commit, tree_decode
from bup.helpers import debug2, last, nullcontext_if_not
from bup.io import path_msg
def tag_item(oid):
assert len(oid) == 20
+ cached = cache_get_commit_item(oid, need_meta=False)
+ if cached:
+ return cached
oidx = hexlify(oid)
it = repo.cat(oidx)
_, typ, size = next(it)
if typ == b'commit':
- return cache_get_commit_item(oid, need_meta=False) \
- or _commit_item_from_data(oid, b''.join(it))
+ return _commit_item_from_data(oid, b''.join(it))
for _ in it: pass
if typ == b'blob':
return Item(meta=default_file_mode, oid=oid)
if parent:
for x in parent:
assert len(x) == 2
- assert isinstance(x[0], (bytes, str_type))
+ assert isinstance(x[0], (bytes, str))
assert isinstance(x[1], item_types)
assert parent[0][1] == _root
if not S_ISDIR(item_mode(parent[-1][1])):