MCPcopy Index your code
hub / github.com/diffgram/diffgram / copy_file_from_existing

Method copy_file_from_existing

shared/database/source_control/file.py:638–854  ·  view source on GitHub ↗

orginal_directory_id is for Video, to get list of video files Should we rename to "source_directory" to keep in line of transfer thing? Clarify working_dir is the "target" directory? Don't actually need directory if not copying links # TODO is "update" real

(
        session,
        working_dir,
        existing_file,
        copy_instance_list: bool = False,
        log = regular_log.default(),
        add_link: bool = True,
        remove_link: bool = True,
        orginal_directory_id = None,
        previous_video_parent_id = None,
        sequence_map = None,
        deep_copy = False,
        defer_copy = False,
        ann_is_complete_reset = False,
        batch_id = None,
        flush_session = False,
        working_dir_id: int = None,
        new_parent_id: int = None
    )

Source from the content-addressed store, hash-verified

636 # TODO rename this copy file ?
637 @staticmethod
638 def copy_file_from_existing(
639 session,
640 working_dir,
641 existing_file,
642 copy_instance_list: bool = False,
643 log = regular_log.default(),
644 add_link: bool = True,
645 remove_link: bool = True,
646 orginal_directory_id = None,
647 previous_video_parent_id = None,
648 sequence_map = None,
649 deep_copy = False,
650 defer_copy = False,
651 ann_is_complete_reset = False,
652 batch_id = None,
653 flush_session = False,
654 working_dir_id: int = None,
655 new_parent_id: int = None
656 ):
657 """
658 orginal_directory_id is for Video, to get list of video files
659 Should we rename to "source_directory" to keep in line of transfer thing?
660
661 Clarify working_dir is the "target" directory?
662 Don't actually need directory if not copying links
663
664 # TODO is "update" really the right name
665 if this is generally creating a new file??
666
667 If file is video, we need to
668 * Create the new video file
669 * Create new files for all of it's frames
670
671
672 ann_is_complete_reset
673 We assume "copying" means copying the status too.
674 However, for the example of tasks (and perhaps others in future)
675 we assume we want to reset this status for the newly created files.
676
677 """
678 # Defer image copy is specified in the parameter.
679 start_time = time.time()
680 if working_dir:
681 working_dir_id = working_dir.id
682
683 # File Copy Defer
684 if defer_copy and not remove_link:
685 regular_methods.transmit_interservice_request_after_commit(
686 session = session,
687 message = 'file_copy',
688 logger = logger,
689 service_target = 'walrus',
690 id = existing_file.id,
691 project_string_id = existing_file.project.project_string_id,
692 extra_params = {'file_id': existing_file.id,
693 'copy_instance_list': copy_instance_list,
694 'destination_working_dir_id': working_dir_id,
695 'source_working_dir_id': orginal_directory_id,

Callers 8

remove_coreFunction · 0.80
__copy_videoMethod · 0.80
__copy_frameMethod · 0.80
__copy_fileMethod · 0.80
create_task_from_fileMethod · 0.80
copy_fileFunction · 0.80
file_transfer_coreFunction · 0.80

Calls 7

InstanceClass · 0.90
set_cache_key_dirtyMethod · 0.80
addMethod · 0.45
removeMethod · 0.45
listMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected