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

Demo project as a submodule #2624

Merged
merged 17 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Setup Python environment
uses: actions/setup-python@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cross-platform-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Setup Node.js environment
uses: actions/setup-node@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dvc-cli-output-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Setup Node.js environment
uses: actions/setup-node@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "demo"]
path = demo
url = https://github.com/iterative/vscode-dvc-demo
Copy link
Member

Choose a reason for hiding this comment

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

@sroy3 this might cause some issues with your current setup. Definitely did for me.

Copy link
Member

Choose a reason for hiding this comment

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

I had to move the already created folder with git mv and then change the .git file and move the module under the root .git

1 change: 1 addition & 0 deletions demo
Submodule demo added at 461d2a
3 changes: 0 additions & 3 deletions demo/.dvc/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions demo/.dvc/config

This file was deleted.

5 changes: 0 additions & 5 deletions demo/.dvcignore

This file was deleted.

7 changes: 0 additions & 7 deletions demo/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions demo/.vscode/extensions.json

This file was deleted.

1 change: 0 additions & 1 deletion demo/data/MNIST/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions demo/data/MNIST/raw.dvc

This file was deleted.

34 changes: 0 additions & 34 deletions demo/dvc.lock

This file was deleted.

22 changes: 0 additions & 22 deletions demo/dvc.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions demo/params.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions demo/requirements.txt

This file was deleted.

163 changes: 0 additions & 163 deletions demo/train.py

This file was deleted.

5 changes: 0 additions & 5 deletions demo/training_metrics.json

This file was deleted.

2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@
},
"completionEvents": [
"onLink:https://github.com/iterative/example-get-started",
"onLink:https://github.com/iterative/vscode-dvc/tree/main/demo",
"onLink:https://github.com/iterative/vscode-dvc-demo",
"onLink:https://dvc.org/doc/dvclive"
]
},
Expand Down
4 changes: 2 additions & 2 deletions extension/resources/walkthrough/setup-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

💡 Check out the
[DVC Get Started](https://github.com/iterative/example-get-started) or
[Extension Demo](https://github.com/iterative/vscode-dvc/tree/main/demo)
projects to quickly try the extension.
[Extension Demo](https://github.com/iterative/vscode-dvc-demo) projects to
quickly try the extension.

To quickly setup a new DVC project run
[`dvc exp init -i`](https://dvc.org/doc/command-reference/exp/init#example-interactive-mode)
Expand Down
14 changes: 8 additions & 6 deletions extension/src/cli/git/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { join } from 'path'

export const DOT_GIT = '.git'
export const DOT_GIT_HEAD = join(DOT_GIT, 'HEAD')
export const DOT_GIT_INDEX = join(DOT_GIT, 'index')
export const GIT_REFS = join(DOT_GIT, 'refs')
export const GIT_LOGS_REFS = join(DOT_GIT, 'logs', 'refs')
export const HEADS_GIT_REFS = join(GIT_REFS, 'heads')
export const gitPath = {
DOT_GIT: '.git',
DOT_GIT_HEAD: 'HEAD',
DOT_GIT_INDEX: 'index',
GIT_LOGS_REFS: join('logs', 'ref'),
GIT_REFS: 'refs',
HEADS_GIT_REFS: 'heads'
} as const

export enum Command {
ADD = 'add',
Expand Down
6 changes: 3 additions & 3 deletions extension/src/cli/git/executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { GitExecutor } from './executor'
import { createProcess } from '../../processExecution'
import { CliResult, CliStarted } from '..'
import { getMockedProcess } from '../../test/util/jest'
import { standardizePath } from '../../fileSystem/path'

jest.mock('vscode')
jest.mock('@hediet/std/disposable')
Expand Down Expand Up @@ -38,9 +39,10 @@ describe('GitExecutor', () => {
} as unknown as EventEmitter<CliStarted>
})

const cwd = standardizePath(__dirname) as string
Copy link
Member

Choose a reason for hiding this comment

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

[F] Followed up and split this function standardizePath(something) as string is everywhere and dumb.


describe('pushBranch', () => {
it('should call createProcess with the correct parameters to push a branch', async () => {
const cwd = __dirname
const branchName = 'my-branch'
mockedCreateProcess.mockReturnValueOnce(
getMockedProcess(
Expand All @@ -57,7 +59,6 @@ describe('GitExecutor', () => {
})

it('should call createProcess with the correct parameters to push the current branch', async () => {
const cwd = __dirname
mockedCreateProcess.mockReturnValueOnce(
getMockedProcess('Everything up-to-date')
)
Expand All @@ -73,7 +74,6 @@ describe('GitExecutor', () => {

describe('stageAndCommit', () => {
it('should call createProcess with the correct parameters to stage all files and then commit', async () => {
const cwd = __dirname
const message = 'best experiment'
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(cwd))
mockedCreateProcess
Expand Down
5 changes: 3 additions & 2 deletions extension/src/cli/git/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Command, Flag } from './constants'
import { getOptions } from './options'
import { Cli } from '..'
import { standardizePath } from '../../fileSystem/path'

export class GitCli extends Cli {
public getGitRepositoryRoot(cwd: string) {
public async getGitRepositoryRoot(cwd: string) {
const options = getOptions(cwd, Command.REV_PARSE, Flag.SHOW_TOPLEVEL)

return this.executeProcess(options)
return standardizePath(await this.executeProcess(options)) as string
}
}
Loading