import collections
import errno
import os
-import platform
import stat
import struct
import sys
for entry in object_store.iter_tree_contents(tree_id):
if not validate_path(entry.path, validate_path_element):
continue
- fs_path = tree_to_fs_path(entry.path)
+ fs_path = _tree_to_fs_path(entry.path)
full_path = os.path.join(root_path, fs_path)
if not os.path.exists(os.path.dirname(full_path)):
root_path = root_path.encode(sys.getfilesystemencoding())
for tree_path, entry in index.iteritems():
- fs_path = tree_to_fs_path(tree_path)
+ fs_path = _tree_to_fs_path(tree_path)
full_path = os.path.join(root_path, fs_path)
blob = blob_from_path_and_stat(full_path, os.lstat(full_path))
if blob.id != entry.sha:
os_sep_bytes = os.sep.encode('ascii')
-def tree_to_fs_path(tree_path):
+def _tree_to_fs_path(tree_path):
"""Convert a git tree path to a file system path.
:param tree_path: Git tree path as bytes
return sep_corrected_path
-def fs_to_tree_path(fs_path):
+def _fs_to_tree_path(fs_path):
"""Convert a file system path to a git tree path.
:param fs_path: File system path.
from dulwich.index import (
blob_from_path_and_stat,
index_entry_from_stat,
- fs_to_tree_path,
+ _fs_to_tree_path,
)
index = self.open_index()
for fs_path in fs_paths:
if not isinstance(fs_path, bytes):
fs_path = fs_path.encode(sys.getfilesystemencoding())
- tree_path = fs_to_tree_path(fs_path)
+ tree_path = _fs_to_tree_path(fs_path)
full_path = os.path.join(root_path_bytes, fs_path)
try:
st = os.lstat(full_path)
write_cache_time,
write_index,
write_index_dict,
- tree_to_fs_path,
- fs_to_tree_path,
+ _tree_to_fs_path,
+ _fs_to_tree_path,
)
from dulwich.object_store import (
MemoryObjectStore,
def test_tree_to_fs_path(self):
tree_path = u'délwíçh/foo'.encode('utf8')
- fs_path = tree_to_fs_path(tree_path)
+ fs_path = _tree_to_fs_path(tree_path)
self.assertEqual(fs_path, os.path.join(u'délwíçh', u'foo').encode('utf8'))
def test_fs_to_tree_path_str(self):
fs_path = os.path.join(os.path.join(u'délwíçh', u'foo'))
- tree_path = fs_to_tree_path(fs_path)
+ tree_path = _fs_to_tree_path(fs_path)
self.assertEqual(tree_path, u'délwíçh/foo'.encode(sys.getfilesystemencoding()))
def test_fs_to_tree_path_bytes(self):
fs_path = os.path.join(os.path.join(u'délwíçh', u'foo').encode('utf8'))
- tree_path = fs_to_tree_path(fs_path)
+ tree_path = _fs_to_tree_path(fs_path)
self.assertEqual(tree_path, u'délwíçh/foo'.encode('utf8'))