Skip to content

Commit

Permalink
Remove commit and share and share as branch options
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Apr 28, 2023
1 parent c0b7cda commit af15f70
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 590 deletions.
50 changes: 0 additions & 50 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,18 +382,6 @@
"command": "dvc.setupWorkspace",
"category": "DVC"
},
{
"title": "Share Experiment as Branch",
"command": "dvc.shareExperimentAsBranch",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Commit and Share Experiment",
"command": "dvc.shareExperimentAsCommit",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Show Commands",
"command": "dvc.showCommands",
Expand Down Expand Up @@ -517,18 +505,6 @@
"category": "DVC",
"icon": "$(play)"
},
{
"title": "Share as Branch",
"command": "dvc.views.experiments.shareExperimentAsBranch",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Commit and Share",
"command": "dvc.views.experiments.shareExperimentAsCommit",
"category": "DVC",
"icon": "$(repo-push)"
},
{
"title": "Share to Studio",
"command": "dvc.views.experiments.shareExperimentToStudio",
Expand Down Expand Up @@ -846,14 +822,6 @@
"command": "dvc.showCommands",
"when": "false"
},
{
"command": "dvc.shareExperimentAsBranch",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running"
},
{
"command": "dvc.shareExperimentAsCommit",
"when": "dvc.commands.available && dvc.project.available && !dvc.experiment.running"
},
{
"command": "dvc.showExperiments",
"when": "dvc.commands.available && dvc.project.available"
Expand Down Expand Up @@ -914,14 +882,6 @@
"command": "dvc.views.experiments.resetAndRunCheckpointExperiment",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentAsBranch",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentAsCommit",
"when": "false"
},
{
"command": "dvc.views.experiments.shareExperimentToStudio",
"when": "false"
Expand Down Expand Up @@ -1191,16 +1151,6 @@
"group": "1_share@0",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.shareExperimentAsCommit",
"group": "1_share@1",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.shareExperimentAsBranch",
"group": "1_share@2",
"when": "view == dvc.views.experimentsTree && dvc.commands.available && viewItem == experiment && !dvc.experiment.running"
},
{
"command": "dvc.views.experiments.runExperiment",
"group": "2_modify@1",
Expand Down
4 changes: 0 additions & 4 deletions extension/src/cli/git/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ export enum Command {
ADD = 'add',
BRANCH = 'branch',
CLEAN = 'clean',
COMMIT = 'commit',
DIFF = 'diff',
INITIALIZE = 'init',
LOG = 'log',
LS_FILES = 'ls-files',
LS_REMOTE = 'ls-remote',
PUSH = 'push',
RESET = 'reset',
REV_PARSE = 'rev-parse',
REV_LIST = 'rev-list'
Expand All @@ -35,7 +33,6 @@ export enum Flag {
FULL_HISTORY = '--full-history',
GET_URL = '--get-url',
HARD = '--hard',
MESSAGE = '-m',
NAME_ONLY = '--name-only',
NO_EMPTY_DIRECTORY = '--no-empty-directory',
NO_MERGE = '--no-merge',
Expand All @@ -45,7 +42,6 @@ export enum Flag {
QUIET = '-q',
RAW_WITH_NUL = '-z',
SEPARATE_WITH_NULL = '-z',
SET_UPSTREAM = '--set-upstream',
SHOW_TOPLEVEL = '--show-toplevel'
}

Expand Down
99 changes: 0 additions & 99 deletions extension/src/cli/git/executor.test.ts

This file was deleted.

23 changes: 1 addition & 22 deletions extension/src/cli/git/executor.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { GitCli } from '.'
import { Args, Command, Commit, DEFAULT_REMOTE, Flag } from './constants'
import { Command, Commit, Flag } from './constants'
import { getOptions } from './options'
import { typeCheckCommands } from '..'

export const autoRegisteredCommands = {
GIT_INIT: 'gitInit',
GIT_PUSH_BRANCH: 'pushBranch',
GIT_RESET_WORKSPACE: 'resetWorkspace',
GIT_STAGE_ALL: 'stageAll',
GIT_STAGE_AND_COMMIT: 'stageAndCommit',
GIT_UNSTAGE_ALL: 'reset'
} as const

Expand All @@ -24,16 +22,6 @@ export class GitExecutor extends GitCli {
return this.executeProcess(options)
}

public pushBranch(cwd: string, branchName?: string) {
const args: Args = [Command.PUSH, Flag.SET_UPSTREAM, DEFAULT_REMOTE]

args.push((branchName || Commit.HEAD) as Commit)

const options = getOptions(cwd, ...args)

return this.executeProcess(options)
}

public reset(cwd: string, ...args: (Flag | Commit)[]) {
const options = getOptions(cwd, Command.RESET, ...args)

Expand All @@ -60,13 +48,4 @@ export class GitExecutor extends GitCli {

return this.executeProcess(options)
}

public async stageAndCommit(cwd: string, message: string) {
await this.stageAll(cwd)

const args = [Command.COMMIT, Flag.MESSAGE, message] as Args
const options = getOptions(cwd, ...args)

return this.executeProcess(options)
}
}
4 changes: 0 additions & 4 deletions extension/src/commands/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export enum RegisteredCliCommands {
EXPERIMENT_RESET_AND_RUN = 'dvc.resetAndRunCheckpointExperiment',
EXPERIMENT_RESUME = 'dvc.resumeCheckpointExperiment',
EXPERIMENT_RUN = 'dvc.runExperiment',
EXPERIMENT_SHARE_AS_BRANCH = 'dvc.shareExperimentAsBranch',
EXPERIMENT_SHARE_AS_COMMIT = 'dvc.shareExperimentAsCommit',
QUEUE_EXPERIMENT = 'dvc.queueExperiment',
QUEUE_KILL = 'dvc.stopQueuedExperiments',
QUEUE_START = 'dvc.startExperimentsQueue',
Expand All @@ -18,8 +16,6 @@ export enum RegisteredCliCommands {
EXPERIMENT_VIEW_BRANCH = 'dvc.views.experiments.branchExperiment',
EXPERIMENT_VIEW_PUSH = 'dvc.views.experiments.pushExperiment',
EXPERIMENT_VIEW_REMOVE = 'dvc.views.experiments.removeExperiment',
EXPERIMENT_VIEW_SHARE_AS_BRANCH = 'dvc.views.experiments.shareExperimentAsBranch',
EXPERIMENT_VIEW_SHARE_AS_COMMIT = 'dvc.views.experiments.shareExperimentAsCommit',
EXPERIMENT_VIEW_SHOW_LOGS = 'dvc.views.experiments.showLogs',
EXPERIMENT_VIEW_STOP = 'dvc.views.experiments.stopQueueExperiment',

Expand Down
94 changes: 1 addition & 93 deletions extension/src/experiments/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Progress, commands } from 'vscode'
import { commands } from 'vscode'
import { AvailableCommands, InternalCommands } from '../../commands/internal'
import { Toast } from '../../vscode/toast'
import { WorkspaceExperiments } from '../workspace'
Expand All @@ -15,98 +15,6 @@ export const getBranchExperimentCommand =
input
)

const applyAndPush = async (
internalCommands: InternalCommands,
progress: Progress<{ increment: number; message: string }>,
cwd: string,
name: string
): Promise<void> => {
await Toast.runCommandAndIncrementProgress(
() =>
internalCommands.executeCommand(
AvailableCommands.EXPERIMENT_APPLY,
cwd,
name
),
progress,
25
)

return Toast.runCommandAndIncrementProgress(
() => internalCommands.executeCommand(AvailableCommands.PUSH, cwd),
progress,
25
)
}

export const getShareExperimentAsBranchCommand =
(internalCommands: InternalCommands) =>
async (cwd: string, name: string, input: string) => {
await Toast.showProgress('Sharing Branch', async progress => {
progress.report({ increment: 0 })

await Toast.runCommandAndIncrementProgress(
() =>
internalCommands.executeCommand(
AvailableCommands.EXPERIMENT_BRANCH,
cwd,
name,
input
),
progress,
25
)

await applyAndPush(internalCommands, progress, cwd, name)

await Toast.runCommandAndIncrementProgress(
() =>
internalCommands.executeCommand(
AvailableCommands.GIT_PUSH_BRANCH,
cwd,
input
),
progress,
25
)

return Toast.delayProgressClosing()
})
}

export const getShareExperimentAsCommitCommand =
(internalCommands: InternalCommands) =>
async (cwd: string, name: string, input: string) => {
await Toast.showProgress('Sharing Commit', async progress => {
progress.report({ increment: 0 })

await applyAndPush(internalCommands, progress, cwd, name)

await Toast.runCommandAndIncrementProgress(
() =>
internalCommands.executeCommand(
AvailableCommands.GIT_STAGE_AND_COMMIT,
cwd,
input
),
progress,
25
)

await Toast.runCommandAndIncrementProgress(
() =>
internalCommands.executeCommand(
AvailableCommands.GIT_PUSH_BRANCH,
cwd
),
progress,
25
)

return Toast.delayProgressClosing()
})
}

export const getShareExperimentToStudioCommand =
(internalCommands: InternalCommands, setup: Setup) =>
({ dvcRoot, id }: { dvcRoot: string; id: string }) => {
Expand Down
Loading

0 comments on commit af15f70

Please sign in to comment.