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

Add command to add data to datasets #847

Merged
merged 11 commits into from
Sep 27, 2021
Merged

Add command to add data to datasets #847

merged 11 commits into from
Sep 27, 2021

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Sep 27, 2021

This PR adds a command to the tracked tree which gives users the ability to add data to a tracked folder from anywhere on their machine. The user can choose files or folders and can pick multiple of each. The command "moves" data instead of coping it so there is a warning modal in place to ask for confirmation.

Demo:

Screen.Recording.2021-09-27.at.2.43.41.pm.mov

Note: Adding a folder into a tracked directory yields the following error from dvc list ->

ERROR: unexpected error - ('/', 'Users', 'mattseddon', 'PP', 'vscode-dvc', 'demo', 'data', 'MNIST', 'raw', 'extra-data') 

I will raise a new bug in the DVC repo. There is placeholder on the board to do it.

@mattseddon mattseddon added the product PR that affects product label Sep 27, 2021
@mattseddon mattseddon self-assigned this Sep 27, 2021
@@ -12,3 +12,19 @@ export const pickFile = async (title: string): Promise<string | undefined> => {
return fsPath
Copy link
Member Author

Choose a reason for hiding this comment

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

[C] File needs renamed

@@ -187,7 +189,10 @@ export class TrackedExplorerTree implements TreeDataProvider<string> {
const absolutePath = join(path, relative.path)
this.pathItems[absolutePath] = {
dvcRoot,
isDirectory: relative.isdir,
// TODO: revert after https://github.com/iterative/dvc/issues/6094 is fixed
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] This is a patch for the bug. Definitely not a long term solution.

)
if (paths) {
await moveTargets(paths, destination)
return fireWatcher(this.getDataPlaceholder(destination))
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] Updates the decorations.

@@ -0,0 +1,30 @@
import { window } from 'vscode'
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] This file has been renamed from pickFile.

Open to a better name if you have one.

@@ -8,6 +9,11 @@ import { isInWorkspace } from './workspace'
import { Repository } from '../repository'
import { EXPERIMENTS_GIT_REFS } from '../experiments/repository'

export const fireWatcher = (path: string): Promise<void> => {
const now = new Date().getTime() / 1000
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

was "good" trying to work out why this only didn't work in the windows part of the CI.

@mattseddon mattseddon marked this pull request as ready for review September 27, 2021 05:40
.mockReturnValueOnce(true)
.mockReturnValueOnce(true)
.mockReturnValueOnce(true)
.mockReturnValueOnce(true)
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] This is a consequence of https://github.com/iterative/vscode-dvc/pull/847/files#r716349187. Very inefficient but temporary.

@mattseddon mattseddon enabled auto-merge (squash) September 27, 2021 19:07
@codeclimate
Copy link

codeclimate bot commented Sep 27, 2021

Code Climate has analyzed commit 669f142 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 96.1% (0.0% change).

View more on Code Climate.

@mattseddon mattseddon merged commit 1d9f439 into master Sep 27, 2021
@mattseddon mattseddon deleted the add-data-to-dataset branch September 27, 2021 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants