From 3d7425c2560378ae78d59d4b746899407acf5d44 Mon Sep 17 00:00:00 2001 From: Austin Locke Date: Mon, 9 Dec 2024 15:57:06 -0600 Subject: [PATCH] PTFM-38976 Update clone/move CLI to accept targetFileRelocation flag. (#1420) PTFM-38976 Update clone/move CLI to accept targetFileRelocation flag. (#1420) --- src/python/dxpy/cli/cp.py | 3 ++- src/python/dxpy/scripts/dx.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/python/dxpy/cli/cp.py b/src/python/dxpy/cli/cp.py index 68d4d779f3..81ad71ffb0 100644 --- a/src/python/dxpy/cli/cp.py +++ b/src/python/dxpy/cli/cp.py @@ -151,7 +151,8 @@ def cp(args): {"objects": src_objects, "folders": src_folders, "project": dest_proj, - "destination": dest_path})['exists'] + "destination": dest_path, + "targetFileRelocation": args.target_file_relocation})['exists'] if len(exists) > 0: print(fill('The following objects already existed in the destination container ' + 'and were left alone:') + '\n ' + '\n '.join(exists)) diff --git a/src/python/dxpy/scripts/dx.py b/src/python/dxpy/scripts/dx.py index 54ece2e4e7..423b225002 100644 --- a/src/python/dxpy/scripts/dx.py +++ b/src/python/dxpy/scripts/dx.py @@ -1037,7 +1037,8 @@ def mv(args): if src_results[0]['describe']['folder'] != dest_folder: dxpy.api.project_move(src_proj, {"objects": [result['id'] for result in src_results], - "destination": dest_folder}) + "destination": dest_folder, + "targetFileRelocation": args.target_file_relocation}) for result in src_results: dxpy.DXHTTPRequest('/' + result['id'] + '/rename', {"project": src_proj, @@ -1065,7 +1066,8 @@ def mv(args): dxpy.api.project_move(src_proj, {"objects": src_objects, "folders": src_folders, - "destination": dest_path}) + "destination": dest_path, + "targetFileRelocation": args.target_file_relocation}) except: err_exit() @@ -4803,6 +4805,7 @@ def positive_number(value): nargs='+') cp_sources_action.completer = DXPathCompleter() parser_cp.add_argument('destination', help=fill('Folder into which to copy the sources or new pathname (if only one source is provided). Must be in a different project/container than all source paths.', width_adjustment=-15)) +parser_cp.add_argument('--target-file-relocation', help='Allow symlink target file relocation in external storage while cloning a symlink.', action='store_true', default=False) parser_cp.set_defaults(func=cp) register_parser(parser_cp, categories='fs') @@ -4818,6 +4821,7 @@ def positive_number(value): nargs='+') mv_sources_action.completer = DXPathCompleter() parser_mv.add_argument('destination', help=fill('Folder into which to move the sources or new pathname (if only one source is provided). Must be in the same project/container as all source paths.', width_adjustment=-15)) +parser_mv.add_argument('--target-file-relocation', help='Allow symlink target file relocation in external storage while moving a symlink.', action='store_true', default=False) parser_mv.set_defaults(func=mv) register_parser(parser_mv, categories='fs')