Skip to content

get: checking target path before downloading#4738

Merged
efiop merged 1 commit into
treeverse:masterfrom
julsal:issue_3673
Oct 27, 2020
Merged

get: checking target path before downloading#4738
efiop merged 1 commit into
treeverse:masterfrom
julsal:issue_3673

Conversation

@julsal
Copy link
Copy Markdown
Contributor

@julsal julsal commented Oct 17, 2020

Fixes #3673

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

Comment thread dvc/external_repo.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @julsal !

Thanks for the PR!

By default force=False, so if the output already exists and it differs from the desired one, then we will prompt user for removal confirmation. E.g.

#!/bin/bash                                                                       
                                                                                  
set -e                                                                            
set -x                                                                            
                                                                                  
rm -rf mytest                                                                     
mkdir mytest                                                                      
cd mytest                                                                         
                                                                                  
echo data > data                                                                  
dvc get https://github.com/iterative/dataset-registry get-started/data.xml -o data # will prompt

So this whole change is not really needed 🙁 You probably got confused by running dvc get ... twice, in which case it won't prompt you simply because the files are identical, so it doesn't have to prompt.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @efiop,

Thanks for the quick reply.

The change comes in the context of #3673, which shows that dvc asks for confirmation only after downloading the file. For this reason I introduced an earlier prompt. force=True comes to avoid another prompt.

Does it make sense when considering the issue?

Copy link
Copy Markdown
Contributor

@efiop efiop Oct 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julsal Ah, I see. Indeed, there was a misunderstanding on my side. Thank you for pointing out!

Just to clarify, this is a good PR 👍 and counts as a pass for the application purposes, but we want to reconsider this from the tree arch perspective, which will require some more effort. So just to not waste your more of your time on this, we could close the PR for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@efiop I agree. A future deeper refactoring might find a more elegant solution. Nonetheless, if you find useful, I changed the PR to keep only the test cases for file replacement.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @julsal 🙏

@efiop efiop merged commit e6016ca into treeverse:master Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get/import: check target path before downloading

2 participants