@@ -184,7 +184,7 @@ def do_filesystem_cp(state, src, dest, multiple, check_hash=False):
184
184
f .write (data )
185
185
186
186
187
- def do_filesystem_recursive_cp (state , src , dest , multiple ):
187
+ def do_filesystem_recursive_cp (state , src , dest , multiple , check_hash ):
188
188
# Ignore trailing / on both src and dest. (Unix cp ignores them too)
189
189
src = src .rstrip ("/" + os .path .sep + (os .path .altsep if os .path .altsep else "" ))
190
190
dest = dest .rstrip ("/" + os .path .sep + (os .path .altsep if os .path .altsep else "" ))
@@ -257,7 +257,7 @@ def _list_recursive(base, src_path, dest_path, src_join_fun, src_isdir_fun, src_
257
257
258
258
# If no directories were encountered then we must have just had a file.
259
259
if not dirs :
260
- return do_filesystem_cp (state , src , dest , multiple )
260
+ return do_filesystem_cp (state , src , dest , multiple , check_hash )
261
261
262
262
def _mkdir (a , * b ):
263
263
try :
@@ -287,7 +287,7 @@ def _mkdir(a, *b):
287
287
else :
288
288
dest_path_joined = os .path .join (dest , * dest_path_split )
289
289
290
- do_filesystem_cp (state , src_path_joined , dest_path_joined , multiple = False , check_hash = True )
290
+ do_filesystem_cp (state , src_path_joined , dest_path_joined , False , check_hash )
291
291
292
292
293
293
def do_filesystem (state , args ):
@@ -352,9 +352,11 @@ def do_filesystem(state, args):
352
352
print (digest .hex ())
353
353
elif command == "cp" :
354
354
if args .recursive :
355
- do_filesystem_recursive_cp (state , path , cp_dest , len (paths ) > 1 )
355
+ do_filesystem_recursive_cp (
356
+ state , path , cp_dest , len (paths ) > 1 , not args .force
357
+ )
356
358
else :
357
- do_filesystem_cp (state , path , cp_dest , len (paths ) > 1 )
359
+ do_filesystem_cp (state , path , cp_dest , len (paths ) > 1 , not args . force )
358
360
except FileNotFoundError as er :
359
361
raise CommandError ("{}: {}: No such file or directory." .format (command , er .args [0 ]))
360
362
except IsADirectoryError as er :
0 commit comments