You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by fu...@apache.org on 2021/02/23 19:47:07 UTC
svn commit: r1886858 -
/subversion/trunk/subversion/bindings/swig/python/tests/fs.py
Author: futatuki
Date: Tue Feb 23 19:47:07 2021
New Revision: 1886858
URL: http://svn.apache.org/viewvc?rev=1886858&view=rev
Log:
swig-py: tests: Fix a wrong handling of internal path.
* subversion/bindings/swig/python/tests/fs.py
(_svn_path_join_internal): New function.
(_get_dir_entries): Use _svn_path_join_internal instead of os.path.join.
Modified:
subversion/trunk/subversion/bindings/swig/python/tests/fs.py
Modified: subversion/trunk/subversion/bindings/swig/python/tests/fs.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/tests/fs.py?rev=1886858&r1=1886857&r2=1886858&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/tests/fs.py (original)
+++ subversion/trunk/subversion/bindings/swig/python/tests/fs.py Tue Feb 23 19:47:07 2021
@@ -61,6 +61,27 @@ def svn_test__set_file_contents(root, pa
def svn_test__get_file_contents(root, path):
return svn_test__stream_to_string(fs.file_contents(root, path))
+
+def _svn_path_join_internal(base, component):
+ """Join a base path (base) with a component (component), in str"""
+
+ # If the component is absolute, then return it.
+ if component[0:1] == '/':
+ return component
+ # If either is empty return the other
+ if base == '':
+ return component
+ if component == '':
+ return base
+
+ if base == '/':
+ # Ignore base, just return separator + component
+ return '/' + component
+
+ # Construnct the new, combined path.
+ return base + '/' + component
+
+
def _get_dir_entries(root, path, tree_entries=None):
if tree_entries is None:
tree_entries = {}
@@ -77,9 +98,7 @@ def _get_dir_entries(root, path, tree_en
name = dirent.name
if not isinstance(name, str):
name = name.decode('utf-8')
- full_path = os.path.join(path, name)
- if not isinstance(full_path, str):
- full_path = full_path.decode('utf-8')
+ full_path = _svn_path_join_internal(path, name)
# Now, copy this dirent to the master hash, but this time, use
# the full path for the key