Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: irods/python-irodsclient
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4aac7f84ce7974087bf89e61b36991a9ffec6b87
Choose a base ref
..
head repository: irods/python-irodsclient
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 68a152af235891a678324e6657e4f20cdb5be687
Choose a head ref
Showing with 4 additions and 3 deletions.
  1. +3 −2 irods/manager/collection_manager.py
  2. +1 −1 irods/test/collection_test.py
5 changes: 3 additions & 2 deletions irods/manager/collection_manager.py
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ def make_writable_dir_if_none_exists( path ):
raise GetPathCreationError( '{!r} not a writable directory'.format(path) )

try:
# Python 2 only
from string import maketrans as _maketrans
except:
_maketrans = str.maketrans
@@ -42,7 +43,7 @@ def put_recursive (self, localpath, path, abort_if_not_empty = True, **put_optio
if abort_if_not_empty and (len(w) > 1 or len(w[0][-1]) > 0):
raise RuntimeError('collection {path!r} exists and is non-empty'.format(**locals()))
localpath = os.path.normpath(localpath)
for my_dir,sub_dirs,sub_files in os.walk(localpath,topdown=True):
for my_dir,_,sub_files in os.walk(localpath,topdown=True):
dir_without_prefix = os.path.relpath( my_dir, localpath )
subcoll = self.sess.collections.create(path if dir_without_prefix == os.path.curdir
else path + "/" + _from_mswin(dir_without_prefix))
@@ -62,7 +63,7 @@ def unprefix (path,prefix=''):
# # nbytes = sum(d.size for el in c.walk() for d in el[2])
# ## (Then use eg tqdm module to create progress-bar.)
c_prefix = c.path + "/"
for coll,sub_colls,sub_datas in c.walk(topdown=True):
for coll,_,sub_datas in c.walk(topdown=True):
relative_collpath = unprefix (coll.path + "/", c_prefix)
new_target_dir = os.path.join(localpath, _to_mswin(relative_collpath))
make_writable_dir_if_none_exists( new_target_dir )
2 changes: 1 addition & 1 deletion irods/test/collection_test.py
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ def test_recursive_collection_get_and_put_276(self):

# check final destination for objects' expected content
obj_payloads = [d.open('r').read() for cpath,datas in summary for d in datas]
self.assertEqual(obj_payloads, [Content] * (Depth * Objs_per_level))
self.assertEqual(obj_payloads, [Content.encode('utf-8')] * (Depth * Objs_per_level))

# check for increase by 1 in successive collection depths
coll_depths = [elem[0].count('/') for elem in summary]