This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
[QUAD] File transfer / Copy: Add ability to create symlink #6344
Open
BenSouchet
wants to merge
1
commit into
ynput:develop
Choose a base branch
from
quadproduction:enhancement/add-symlink-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import os | ||
import re | ||
import logging | ||
import sys | ||
import copy | ||
|
@@ -281,8 +282,8 @@ def register(self, instance, file_transactions, filtered_repres): | |
instance) | ||
|
||
for src, dst in prepared["transfers"]: | ||
# todo: add support for hardlink transfers | ||
file_transactions.add(src, dst) | ||
file_transaction_mode = self.get_file_transaction_mode(instance, src) | ||
file_transactions.add(src, dst, mode=file_transaction_mode) | ||
|
||
prepared_representations.append(prepared) | ||
|
||
|
@@ -294,7 +295,8 @@ def register(self, instance, file_transactions, filtered_repres): | |
|
||
file_copy_modes = [ | ||
("transfers", FileTransaction.MODE_COPY), | ||
("hardlinks", FileTransaction.MODE_HARDLINK) | ||
("hardlinks", FileTransaction.MODE_HARDLINK), | ||
("symlinks", FileTransaction.MODE_SYMLINK) | ||
] | ||
for files_type, copy_mode in file_copy_modes: | ||
for src, dst in instance.data.get(files_type, []): | ||
|
@@ -404,6 +406,26 @@ def register(self, instance, file_transactions, filtered_repres): | |
) | ||
) | ||
|
||
@staticmethod | ||
def get_file_transaction_mode(instance, src): | ||
transaction_mode = FileTransaction.MODE_COPY | ||
|
||
is_symlink_requested = False | ||
hierarchy_data = instance.data.get("hierarchyData") | ||
if hierarchy_data and hierarchy_data.get("symlink") == "True": | ||
is_symlink_requested = True | ||
|
||
if not is_symlink_requested: | ||
return transaction_mode | ||
|
||
pattern = instance.context.data["project_settings"]["global"]["tools"]["publish"]["symlink"][ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line too long (101 > 79 characters) |
||
"file_regex_pattern"] | ||
|
||
if not pattern or bool(re.match(pattern, src)): | ||
transaction_mode = FileTransaction.MODE_SYMLINK | ||
|
||
return transaction_mode | ||
|
||
def prepare_subset(self, instance, op_session, project_name): | ||
asset_doc = instance.data["assetEntity"] | ||
subset_name = instance.data["subset"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (85 > 79 characters)