Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement lakectl local checkout #6360

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Conversation

N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Aug 10, 2023

Closes #6348

Change Description

Background

Implement lakectl local command to sync local directory with the remote state, overwriting any local change

New Feature

Part of task #6239

Testing Details

Unit testing for tools, lakectl tests will be added for esti upon feature completion. SyncManager will be tested as part of the command (was tested manually)

Breaking Change?

No

@N-o-Z N-o-Z added area/lakectl Issues related to lakeFS' command line interface (lakectl) exclude-changelog PR description should not be included in next release changelog lakectl-local labels Aug 10, 2023
@N-o-Z N-o-Z requested a review from guy-har August 10, 2023 06:45
@N-o-Z N-o-Z self-assigned this Aug 10, 2023
@github-actions
Copy link

github-actions bot commented Aug 10, 2023

🎊 PR Preview ee2d74e has been successfully built and deployed to https://treeverse-lakeFS-preview-pr-6360.surge.sh

🕐 Build time: 0.016s

🤖 By surge-preview

Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

Overall looks good,
Changes requested just because I would like to get an error of unknown ref before any changes were made
Furthermore, I'm having a hard time understanding what justification is there to first revert my changes and then get the commit. let's say I removed a big file that was also removed from the new branch I'm going to checkout why do I need to download it in order to delete it? can't checkout just go over my current directory and align it to the requested ref?

Comment on lines 64 to 72
if specifiedRef != "" {
newRemote := remote.WithRef(specifiedRef)
newHead := resolveCommitOrDie(cmd.Context(), client, newRemote.Repository, newRemote.Ref)
newBase := newRemote.WithRef(newHead)
// write new index
_, err = local.WriteIndex(idx.LocalPath(), newRemote, newHead)
if err != nil {
DieErr(err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move these to top, in case the commit isn't found I would like to know it before I erase all my local changes

@N-o-Z N-o-Z requested a review from guy-har August 10, 2023 10:10
Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

Looks much better,
Just to make sure ( even though you mentioned) - how was this tested?
Still have my concerns according to corrupted data in case of error during the operation, we need to remember all the cases, and maybe we should mention them in the issue

@N-o-Z
Copy link
Member Author

N-o-Z commented Aug 10, 2023

Looks much better, Just to make sure ( even though you mentioned) - how was this tested? Still have my concerns according to corrupted data in case of error during the operation, we need to remember all the cases, and maybe we should mention them in the issue

I think we'll try a general approach for all lakectl local commands

@N-o-Z N-o-Z merged commit a9981ac into master Aug 10, 2023
33 checks passed
@N-o-Z N-o-Z deleted the task/lakectl-local-checkout-6348 branch August 10, 2023 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lakectl Issues related to lakeFS' command line interface (lakectl) exclude-changelog PR description should not be included in next release changelog lakectl-local
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement lakectl local checkout
2 participants