@@ -132,6 +132,13 @@ def should_update_strategy(self) -> bool:
132132 """
133133 return self .repeat_handling_strategy is RepeatHandlingStrategy .Update
134134
135+ @property
136+ def should_fork_strategy (self ) -> bool :
137+ """
138+ Determines whether the repeat handling strategy should fork the entity.
139+ """
140+ return self .repeat_handling_strategy is RepeatHandlingStrategy .Fork
141+
135142
136143@shared_task (base = _MigrationTask , bind = True )
137144# Note: The decorator @set_code_owner_attribute cannot be used here because the UserTaskMixin
@@ -601,8 +608,9 @@ def _get_distinct_target_container_key(
601608 Returns:
602609 LibraryContainerLocator: The target container key.
603610 """
604- # Check if we already processed this block
605- if context .is_already_migrated (source_key ):
611+ # Check if we already processed this block and we are not forking. If we are forking, we will
612+ # want a new target key.
613+ if context .is_already_migrated (source_key ) and not context .should_fork_strategy :
606614 existing_version = context .get_existing_target (source_key )
607615
608616 return LibraryContainerLocator (
@@ -646,8 +654,9 @@ def _get_distinct_target_usage_key(
646654 Raises:
647655 ValueError: If source_key is invalid
648656 """
649- # Check if we already processed this block
650- if context .is_already_migrated (source_key ):
657+ # Check if we already processed this block and we are not forking. If we are forking, we will
658+ # want a new target key.
659+ if context .is_already_migrated (source_key ) and not context .should_fork_strategy :
651660 log .debug (f"Block { source_key } already exists, reusing existing target" )
652661 existing_target = context .get_existing_target (source_key )
653662 block_id = existing_target .component .local_key
0 commit comments