Merge branch 'main' of github.com:dolthub/dolt into nicktobey/dolt-show

This commit is contained in:
Nick Tobey
2023-04-24 14:02:55 -07:00
162 changed files with 1584 additions and 952 deletions

View File

@@ -40,6 +40,11 @@ jobs:
echo "code is formatted"
else
echo "code is not formatted"
if [ "${{ github.repository }}" != "dolthub/dolt" ]; then
echo "Pull requests from forks must be manually formatted."
echo "Please run dolt/go/utils/repofmt/format_repo.sh to format this pull request."
exit 1;
fi
echo "format=true" >> $GITHUB_OUTPUT
fi
env:
@@ -73,9 +78,38 @@ jobs:
echo "$diff"
exit 1
fi
format:
get-artifacts:
needs: verify
if: ${{ needs.verify.outputs.format == 'true' }}
name: Get artifacts
runs-on: ubuntu-22.04
steps:
- name: Setup Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.19
- uses: actions/checkout@v3
with:
ref: "main"
repository: "dolthub/dolt"
submodules: true
- name: Copy script
working-directory: ./go/utils/repofmt
run: cp format_repo.sh _format_repo.sh
- name: Build go deps tool
working-directory: go/utils/3pdeps
run: go build .
- uses: actions/upload-artifact@v3
with:
name: update-godeps-tool
path: go/utils/3pdeps/3pdeps
- uses: actions/upload-artifact@v3
with:
name: format-code-script
path: go/utils/repofmt/_format_repo.sh
format:
needs: [verify, get-artifacts]
if: ${{ needs.verify.outputs.format == 'true' }}
name: Format PR
runs-on: ubuntu-22.04
steps:
@@ -93,14 +127,33 @@ jobs:
working-directory: ./go
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Format repo and update licenses
- uses: actions/download-artifact@v3
with:
name: format-code-script
path: go/utils/repofmt
- uses: actions/download-artifact@v3
with:
name: update-godeps-tool
path: go
- name: Format repo
working-directory: ./go
run: |
./utils/repofmt/format_repo.sh
./Godeps/update.sh
chmod +x ./utils/repofmt/_format_repo.sh
./utils/repofmt/_format_repo.sh
env:
BRANCH_NAME: ${{ github.head_ref }}
CHANGE_TARGET: ${{ github.base_ref }}
- name: Update Go deps
working-directory: ./go
run: |
chmod +x ./3pdeps
( go list -deps -json ./cmd/dolt/. && \
GOOS=windows go list -deps -json ./cmd/dolt/. ) \
| ./3pdeps > ./Godeps/LICENSES
- name: Remove artifacts
run: |
rm go/3pdeps
rm go/utils/repofmt/_format_repo.sh
- name: Changes detected
id: detect-changes
run: |

8
go/Godeps/LICENSES generated
View File

@@ -1666,7 +1666,7 @@ SOFTWARE.
================================================================================
================================================================================
= github.com/dolthub/flatbuffers licensed under: =
= github.com/dolthub/flatbuffers/v23 licensed under: =
Apache License
@@ -1871,7 +1871,7 @@ SOFTWARE.
See the License for the specific language governing permissions and
limitations under the License.
= LICENSE.txt 75cd5500580317e758b5e984e017524dc961140e4889f7d427f85e41 =
= LICENSE 75cd5500580317e758b5e984e017524dc961140e4889f7d427f85e41 =
================================================================================
================================================================================
@@ -2313,7 +2313,7 @@ SOFTWARE.
The MIT License (MIT)
Copyright (c) 2015 oliver
Copyright (c) 2021, 2015; DoltHub Authors, oliver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -2334,7 +2334,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
= LICENSE a33ad37999b0aa5d38b8bc56a9c6b2d6287a7e2478ee822af7fa7a11 =
= LICENSE 18bf16f1b1dc8f5ace048507fc77c4aebe34aaaf174e30020ab27303 =
================================================================================
================================================================================

View File

@@ -0,0 +1,19 @@
// Copyright 2023 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
// CliContexct is used to pass top level command information down to subcommands.
type CliContext interface {
}

View File

@@ -64,7 +64,7 @@ type Command interface {
// Description returns a description of the command
Description() string
// Exec executes the command
Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int
Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *CliContext) int
// Docs returns the documentation for this command, or nil if it's undocumented
Docs() *CommandDocumentation
// ArgParser returns the arg parser for this command
@@ -169,7 +169,7 @@ func (hc SubCommandHandler) Hidden() bool {
return hc.hidden
}
func (hc SubCommandHandler) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (hc SubCommandHandler) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *CliContext) int {
if len(args) < 1 && hc.Unspecified == nil {
hc.printUsage(commandStr)
return 1
@@ -234,7 +234,7 @@ func (hc SubCommandHandler) handleCommand(ctx context.Context, commandStr string
return 1
}
ret := cmd.Exec(ctx, commandStr, args, dEnv)
ret := cmd.Exec(ctx, commandStr, args, dEnv, nil)
if evt != nil {
events.GlobalCollector.CloseEventAndAdd(evt)

View File

@@ -68,7 +68,7 @@ func (cmd *trackedCommand) RequiresRepo() bool {
return false
}
func (cmd *trackedCommand) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd *trackedCommand) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *CliContext) int {
cmd.called = true
cmd.cmdStr = commandStr
cmd.args = args
@@ -133,7 +133,7 @@ func runCommand(root Command, commandLine string) int {
panic("Invalid test command line")
}
return root.Exec(context.Background(), appName, tokens[1:], nil)
return root.Exec(context.Background(), appName, tokens[1:], nil, nil)
}
func TestHasHelpFlag(t *testing.T) {

View File

@@ -60,7 +60,7 @@ func (cmd AddCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd AddCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd AddCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateAddArgParser()
helpPr, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, addDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, helpPr)

View File

@@ -64,7 +64,7 @@ func (cmd SetRefCmd) Hidden() bool {
// Version displays the version of the running dolt client
// Exec executes the command
func (cmd SetRefCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd SetRefCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
usage, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cli.CommandDocumentationContent{}, ap))

View File

@@ -60,7 +60,7 @@ func (cmd ShowRootCmd) Hidden() bool {
// Version displays the version of the running dolt client
// Exec executes the command
func (cmd ShowRootCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ShowRootCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
usage, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cli.CommandDocumentationContent{}, ap))

View File

@@ -66,7 +66,7 @@ func (a Assist) Hidden() bool {
return true
}
func (a *Assist) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (a *Assist) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
a.messages = make([]string, 0)
apiKey, ok := os.LookupEnv("OPENAI_API_KEY")

View File

@@ -105,7 +105,7 @@ func (cmd BackupCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd BackupCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd BackupCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, backupDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -79,7 +79,7 @@ func (cmd BlameCmd) EventType() eventsapi.ClientEventType {
//
// When all nodes have blame information, stop iterating through commits and print the blame graph.
// Exec executes the command
func (cmd BlameCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd BlameCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, blameDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
@@ -90,5 +90,5 @@ func (cmd BlameCmd) Exec(ctx context.Context, commandStr string, args []string,
}
args = []string{"--" + QueryFlag, fmt.Sprintf(blameQueryTemplate, apr.Arg(0))}
return SqlCmd{}.Exec(ctx, "sql", args, dEnv)
return SqlCmd{}.Exec(ctx, "sql", args, dEnv, nil)
}

View File

@@ -98,7 +98,7 @@ func (cmd BranchCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd BranchCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd BranchCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, branchDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -78,7 +78,7 @@ func (cmd CheckoutCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd CheckoutCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CheckoutCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateCheckoutArgParser()
helpPrt, usagePrt := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, checkoutDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, helpPrt)

View File

@@ -71,7 +71,7 @@ func (cmd CherryPickCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command.
func (cmd CherryPickCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CherryPickCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateCherryPickArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cherryPickDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
@@ -156,13 +156,13 @@ func cherryPick(ctx context.Context, dEnv *env.DoltEnv, cherryStr string) errhan
if err != nil {
return errhand.VerboseErrorFromError(err)
}
res := AddCmd{}.Exec(ctx, "add", []string{"-A"}, dEnv)
res := AddCmd{}.Exec(ctx, "add", []string{"-A"}, dEnv, nil)
if res != 0 {
return errhand.BuildDError("dolt add failed").AddCause(err).Build()
}
commitParams := []string{"-m", commitMsg}
res = CommitCmd{}.Exec(ctx, "commit", commitParams, dEnv)
res = CommitCmd{}.Exec(ctx, "commit", commitParams, dEnv, nil)
if res != 0 {
return errhand.BuildDError("dolt commit failed").AddCause(err).Build()
}

View File

@@ -65,7 +65,7 @@ func (cmd CleanCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd CleanCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CleanCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateCleanArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cleanDocContent, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -81,7 +81,7 @@ func (cmd CloneCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd CloneCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CloneCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cloneDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -75,7 +75,7 @@ func (cmd CatCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd CatCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CatCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, catDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -88,7 +88,7 @@ func (cmd ResolveCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd ResolveCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ResolveCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, resDocumentation, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -62,6 +62,6 @@ func TestCommandsRequireInitializedDir(t *testing.T) {
dEnv := createUninitializedEnv()
for _, test := range tests {
test.comm.Exec(context.Background(), test.cmdStr, test.args, dEnv)
test.comm.Exec(context.Background(), test.cmdStr, test.args, dEnv, nil)
}
}

View File

@@ -76,14 +76,14 @@ func (cmd CommitCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd CommitCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CommitCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
res := performCommit(ctx, commandStr, args, dEnv)
if res == 1 {
return res
}
// if the commit was successful, print it out using the log command
return LogCmd{}.Exec(ctx, "log", []string{"-n=1"}, dEnv)
return LogCmd{}.Exec(ctx, "log", []string{"-n=1"}, dEnv, nil)
}
func performCommit(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {

View File

@@ -116,7 +116,7 @@ func (cmd ConfigCmd) ArgParser() *argparser.ArgParser {
// Exec is used by the config command to allow users to view / edit their global and repository local configurations.
// Exec executes the command
func (cmd ConfigCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ConfigCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cfgDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -280,8 +280,8 @@ func TestConfig(t *testing.T) {
// test setting global config with --add
configCmd := ConfigCmd{}
ret := configCmd.Exec(ctx, "dolt config", []string{"-global", "--add", "name", "bheni"}, dEnv)
ret += configCmd.Exec(ctx, "dolt config", []string{"-global", "--add", "title", "dufus"}, dEnv)
ret := configCmd.Exec(ctx, "dolt config", []string{"-global", "--add", "name", "bheni"}, dEnv, nil)
ret += configCmd.Exec(ctx, "dolt config", []string{"-global", "--add", "title", "dufus"}, dEnv, nil)
expectedGlobal := map[string]string{
"name": "bheni",
@@ -295,7 +295,7 @@ func TestConfig(t *testing.T) {
}
// test setting global config with --set
ret = configCmd.Exec(ctx, "dolt config", []string{"-global", "--set", "name", "steph"}, dEnv)
ret = configCmd.Exec(ctx, "dolt config", []string{"-global", "--set", "name", "steph"}, dEnv, nil)
expectedGlobal = map[string]string{
"name": "steph",
@@ -309,7 +309,7 @@ func TestConfig(t *testing.T) {
}
// test setting local config with --add
ret = configCmd.Exec(ctx, "dolt config", []string{"-local", "--add", "title", "senior dufus"}, dEnv)
ret = configCmd.Exec(ctx, "dolt config", []string{"-local", "--add", "title", "senior dufus"}, dEnv, nil)
expectedLocal := map[string]string{
"title": "senior dufus",
@@ -324,7 +324,7 @@ func TestConfig(t *testing.T) {
}
// test setting local config with --set
ret = configCmd.Exec(ctx, "dolt config", []string{"-local", "--set", "name", "steph"}, dEnv)
ret = configCmd.Exec(ctx, "dolt config", []string{"-local", "--set", "name", "steph"}, dEnv, nil)
expectedLocal = map[string]string{
"name": "steph",
@@ -339,7 +339,7 @@ func TestConfig(t *testing.T) {
t.Error("Unexpected value of \"name\" retrieved from the config hierarchy")
}
ret = configCmd.Exec(ctx, "dolt config", []string{"-global", "--unset", "name"}, dEnv)
ret = configCmd.Exec(ctx, "dolt config", []string{"-global", "--unset", "name"}, dEnv, nil)
expectedGlobal = map[string]string{
"title": "dufus",
@@ -402,14 +402,14 @@ func TestInvalidConfigArgs(t *testing.T) {
configCmd := ConfigCmd{}
// local and global flags passed together is invalid
ret := configCmd.Exec(ctx, "dolt config", []string{"--global", "--local", "--add", "name", "bheni"}, dEnv)
ret := configCmd.Exec(ctx, "dolt config", []string{"--global", "--local", "--add", "name", "bheni"}, dEnv, nil)
if ret == 0 {
t.Error("Invalid commands should fail. Command has both local and global")
}
// both -add and -get are used
ret = configCmd.Exec(ctx, "dolt config", []string{"-global", "--get", "--add", "title"}, dEnv)
ret = configCmd.Exec(ctx, "dolt config", []string{"-global", "--get", "--add", "title"}, dEnv, nil)
if ret == 0 {
t.Error("Invalid commands should fail. Command is missing local/global")

View File

@@ -78,7 +78,7 @@ func (cmd CheckCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd CheckCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CheckCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, checkDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -89,7 +89,7 @@ func (cmd ImportCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, importDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -74,7 +74,7 @@ func (cmd LsCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, lsDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -70,7 +70,7 @@ func (cmd NewCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd NewCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd NewCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, newDocs, ap))
cli.ParseArgsOrDie(ap, args, help)

View File

@@ -67,7 +67,7 @@ func (cmd RmCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd RmCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd RmCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, rmDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -73,7 +73,7 @@ func (cmd UseCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd UseCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd UseCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, useDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -67,7 +67,7 @@ func (cmd VerifyConstraintsCmd) ArgParser() *argparser.ArgParser {
return cli.CreateVerifyConstraintsArgParser(cmd.Name())
}
func (cmd VerifyConstraintsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd VerifyConstraintsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, verifyConstraintsDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -159,7 +159,7 @@ func (cmd DiffCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd DiffCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd DiffCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, diffDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -66,7 +66,7 @@ func (cmd DiffCmd) ArgParser() *argparser.ArgParser {
}
// Exec implements cli.Command.
func (cmd DiffCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd DiffCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, diffDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -71,7 +71,7 @@ func (cmd UploadCmd) ArgParser() *argparser.ArgParser {
}
// Exec implements cli.Command.
func (cmd UploadCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd UploadCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, uploadDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -69,7 +69,7 @@ func (cmd PrintCmd) ArgParser() *argparser.ArgParser {
}
// Exec implements cli.Command.
func (cmd PrintCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd PrintCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, printDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -113,7 +113,7 @@ func (cmd DumpCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd DumpCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd DumpCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, dumpDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -72,7 +72,7 @@ func (cmd *DumpDocsCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd *DumpDocsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd *DumpDocsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cli.CommandDocumentationContent{}, ap))

View File

@@ -68,7 +68,7 @@ func (cmd FetchCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd FetchCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd FetchCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateFetchArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, fetchDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -96,7 +96,7 @@ func (cmd FilterBranchCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd FilterBranchCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd FilterBranchCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, filterBranchDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -81,7 +81,7 @@ func (cmd GarbageCollectionCmd) EventType() eventsapi.ClientEventType {
// Version displays the version of the running dolt client
// Exec executes the command
func (cmd GarbageCollectionCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd GarbageCollectionCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
var verr errhand.VerboseError
ap := cmd.ArgParser()

View File

@@ -47,7 +47,7 @@ func (z GenZshCompCmd) Description() string {
return "Creates a zsh autocomp file for all dolt commands"
}
func (z GenZshCompCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (z GenZshCompCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := z.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cli.CommandDocumentationContent{}, ap))

View File

@@ -79,7 +79,7 @@ func (cmd CatCmd) ArgParser() *argparser.ArgParser {
return ap
}
func (cmd CatCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CatCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, catDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -55,7 +55,7 @@ func (cmd LsCmd) ArgParser() *argparser.ArgParser {
return ap
}
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
ap.TooManyArgsErrorFunc = func(receivedArgs []string) error {
args := strings.Join(receivedArgs, ", ")

View File

@@ -58,7 +58,7 @@ func (cmd RebuildCmd) ArgParser() *argparser.ArgParser {
return ap
}
func (cmd RebuildCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd RebuildCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, rebuildDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -86,7 +86,7 @@ func (cmd InitCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd InitCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd InitCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, initDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -67,7 +67,7 @@ func TestInit(t *testing.T) {
gCfg, _ := dEnv.Config.GetConfig(env.GlobalConfig)
gCfg.SetStrings(test.GlobalConfig)
result := InitCmd{}.Exec(context.Background(), "dolt init", test.Args, dEnv)
result := InitCmd{}.Exec(context.Background(), "dolt init", test.Args, dEnv, nil)
defer dEnv.DoltDB.Close()
require.Equalf(t, test.ExpectSuccess, result == 0, "- Expected success: %t; result: %t;", test.ExpectSuccess, result == 0)
@@ -86,13 +86,11 @@ func TestInit(t *testing.T) {
func TestInitTwice(t *testing.T) {
dEnv := createUninitializedEnv()
result := InitCmd{}.Exec(context.Background(), "dolt init",
[]string{"-name", "Bill Billerson", "-email", "bigbillieb@fake.horse"}, dEnv)
result := InitCmd{}.Exec(context.Background(), "dolt init", []string{"-name", "Bill Billerson", "-email", "bigbillieb@fake.horse"}, dEnv, nil)
require.True(t, result == 0, "First init should succeed")
defer dEnv.DoltDB.Close()
result = InitCmd{}.Exec(context.Background(), "dolt init",
[]string{"-name", "Bill Billerson", "-email", "bigbillieb@fake.horse"}, dEnv)
result = InitCmd{}.Exec(context.Background(), "dolt init", []string{"-name", "Bill Billerson", "-email", "bigbillieb@fake.horse"}, dEnv, nil)
require.True(t, result != 0, "Second init should fail")
}

View File

@@ -73,7 +73,7 @@ func (cmd InspectCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd InspectCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd InspectCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cli.CommandDocumentationContent{}, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -109,7 +109,7 @@ func (cmd LogCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd LogCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd LogCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
return cmd.logWithLoggerFunc(ctx, commandStr, args, dEnv)
}

View File

@@ -94,7 +94,7 @@ func (cmd LoginCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd LoginCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd LoginCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, loginDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -78,7 +78,7 @@ func (cmd LsCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd LsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, lsDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -77,7 +77,7 @@ func (cmd MergeCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd MergeCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd MergeCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateMergeArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, mergeDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -65,7 +65,7 @@ func (cmd MergeBaseCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd MergeBaseCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd MergeBaseCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, mergeBaseDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -75,7 +75,7 @@ func (cmd MigrateCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd MigrateCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd MigrateCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, migrateDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -68,7 +68,7 @@ func (cmd PullCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd PullCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd PullCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreatePullArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, pullDocs, ap))

View File

@@ -80,7 +80,7 @@ func (cmd PushCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd PushCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd PushCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, pushDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -84,7 +84,7 @@ func (cmd ReadTablesCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd ReadTablesCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ReadTablesCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, readTablesDocs, ap))

View File

@@ -101,7 +101,7 @@ func (cmd RemoteCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd RemoteCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd RemoteCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, remoteDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -81,7 +81,7 @@ func (cmd ResetCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd ResetCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ResetCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateResetArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, resetDocContent, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -64,7 +64,7 @@ func (cmd RevertCmd) ArgParser() *argparser.ArgParser {
}
// Exec implements the interface cli.Command.
func (cmd RevertCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd RevertCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateRevertArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, revertDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
@@ -144,7 +144,7 @@ func (cmd RevertCmd) Exec(ctx context.Context, commandStr string, args []string,
if err != nil {
return HandleVErrAndExitCode(errhand.VerboseErrorFromError(err), usage)
}
res := AddCmd{}.Exec(ctx, "add", []string{"-A"}, dEnv)
res := AddCmd{}.Exec(ctx, "add", []string{"-A"}, dEnv, nil)
if res != 0 {
return res
}
@@ -156,5 +156,5 @@ func (cmd RevertCmd) Exec(ctx context.Context, commandStr string, args []string,
commitParams = append(commitParams, "--author", authorStr)
}
return CommitCmd{}.Exec(ctx, "commit", commitParams, dEnv)
return CommitCmd{}.Exec(ctx, "commit", commitParams, dEnv, nil)
}

View File

@@ -80,7 +80,7 @@ func (cmd RootsCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd RootsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd RootsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, cli.CommandDocumentationContent{}, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -74,7 +74,7 @@ func (cmd ExportCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd ExportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ExportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, schExportDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -160,7 +160,7 @@ func (cmd ImportCmd) ArgParser() *argparser.ArgParser {
// Exec implements the import schema command that will take a file and infer it's schema, and then create a table matching that schema.
// Exec executes the command
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, schImportDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -33,6 +33,6 @@ func TestSchemaExport(t *testing.T) {
args := []string{}
commandStr := "dolt schema export"
result := ExportCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := ExportCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, 0, result)
}

View File

@@ -73,7 +73,7 @@ func (cmd ShowCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd ShowCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ShowCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, tblSchemaDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -64,7 +64,7 @@ func (cmd TagsCmd) ArgParser() *argparser.ArgParser {
return ap
}
func (cmd TagsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd TagsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, tblTagsDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -65,7 +65,7 @@ func (cmd UpdateTagCmd) ArgParser() *argparser.ArgParser {
return ap
}
func (cmd UpdateTagCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd UpdateTagCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, updateTagDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -74,7 +74,7 @@ func (cmd SendMetricsCmd) ArgParser() *argparser.ArgParser {
// Exec is the implementation of the command that flushes the events to the grpc service
// Exec executes the command
func (cmd SendMetricsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd SendMetricsCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
if dEnv.DoltDB != nil { // see go/cmd/dolt/dolt.go:interceptSendMetrics()
cli.PrintErrln("expected DoltEnv without DoltDB")
return 1

View File

@@ -96,7 +96,7 @@ func (cmd ShowCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd ShowCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ShowCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, showDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -179,7 +179,7 @@ func (cmd SqlCmd) RequiresRepo() bool {
// Exec executes the command
// Unlike other commands, sql doesn't set a new working root directly, as the SQL layer updates the working set as
// necessary when committing work.
func (cmd SqlCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd SqlCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, sqlDocs, ap))

View File

@@ -53,7 +53,7 @@ func TestSqlConsole(t *testing.T) {
args := []string{}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, 0, result)
})
@@ -81,7 +81,7 @@ func TestSqlBatchMode(t *testing.T) {
args := []string{"-b", "-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
})
}
@@ -120,7 +120,7 @@ func TestSqlSelect(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
})
}
@@ -146,7 +146,7 @@ func TestSqlShow(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
})
}
@@ -179,7 +179,7 @@ func TestCreateTable(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
working, err = dEnv.WorkingRoot(context.Background())
@@ -219,7 +219,7 @@ func TestShowTables(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
})
}
@@ -250,7 +250,7 @@ func TestAlterTable(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
})
}
@@ -277,7 +277,7 @@ func TestDropTable(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv)
result := SqlCmd{}.Exec(context.TODO(), commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
})
}
@@ -396,7 +396,7 @@ func TestInsert(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(ctx, commandStr, args, dEnv)
result := SqlCmd{}.Exec(ctx, commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
if result == 0 {
@@ -477,7 +477,7 @@ func TestUpdate(t *testing.T) {
args := []string{"-q", test.query}
commandStr := "dolt sql"
result := SqlCmd{}.Exec(ctx, commandStr, args, dEnv)
result := SqlCmd{}.Exec(ctx, commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
if result == 0 {
@@ -552,7 +552,7 @@ func TestDelete(t *testing.T) {
ctx := context.Background()
commandStr := "dolt sql"
result := SqlCmd{}.Exec(ctx, commandStr, args, dEnv)
result := SqlCmd{}.Exec(ctx, commandStr, args, dEnv, nil)
assert.Equal(t, test.expectedRes, result)
if result == 0 {

View File

@@ -66,7 +66,7 @@ func Serve(
}
serverController.StopServer()
serverController.serverStopped(closeError)
sqlserver.SetRunningServer(nil)
sqlserver.UnsetRunningServer()
}()
if startError = ValidateConfig(serverConfig); startError != nil {
@@ -211,7 +211,9 @@ func Serve(
cli.PrintErr(startError)
return
}
sqlserver.SetRunningServer(mySQLServer)
lck := env.NewDBLock(serverConfig.Port())
sqlserver.SetRunningServer(mySQLServer, &lck)
var metSrv *http.Server
if serverConfig.MetricsHost() != "" && serverConfig.MetricsPort() > 0 {
@@ -311,7 +313,8 @@ func Serve(
startError = env.ErrActiveServerLock.New(f)
return
}
if err = mrEnv.Lock(); err != nil {
if err = mrEnv.Lock(lck); err != nil {
startError = err
return
}
@@ -390,7 +393,7 @@ func newSessionBuilder(se *engine.SqlEngine, config ServerConfig) server.Session
dsess, err := se.NewDoltSession(ctx, mysqlBaseSess)
if err != nil {
if goerrors.Is(err, env.ErrFailedToAccessDB) {
if server := sqlserver.GetRunningServer(); server != nil {
if server, _ := sqlserver.GetRunningServer(); server != nil {
_ = server.Close()
}
}

View File

@@ -99,7 +99,7 @@ func (cmd SqlClientCmd) Hidden() bool {
return false
}
func (cmd SqlClientCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd SqlClientCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, sqlClientDocs, ap))

View File

@@ -173,7 +173,7 @@ func (cmd SqlServerCmd) RequiresRepo() bool {
}
// Exec executes the command
func (cmd SqlServerCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd SqlServerCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
controller := NewServerController()
newCtx, cancelF := context.WithCancel(context.Background())
go func() {

View File

@@ -63,7 +63,7 @@ func (cmd StashClearCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd StashClearCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd StashClearCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
if !dEnv.DoltDB.Format().UsesFlatbuffers() {
cli.PrintErrln(ErrStashNotSupportedForOldFormat.Error())
return 1

View File

@@ -66,7 +66,7 @@ func (cmd StashDropCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd StashDropCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd StashDropCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
if !dEnv.DoltDB.Format().UsesFlatbuffers() {
cli.PrintErrln(ErrStashNotSupportedForOldFormat.Error())
return 1

View File

@@ -63,7 +63,7 @@ func (cmd StashListCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd StashListCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd StashListCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
if !dEnv.DoltDB.Format().UsesFlatbuffers() {
cli.PrintErrln(ErrStashNotSupportedForOldFormat.Error())
return 1

View File

@@ -70,7 +70,7 @@ func (cmd StashPopCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd StashPopCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd StashPopCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
if !dEnv.DoltDB.Format().UsesFlatbuffers() {
cli.PrintErrln(ErrStashNotSupportedForOldFormat.Error())
return 1
@@ -104,7 +104,7 @@ func (cmd StashPopCmd) Exec(ctx context.Context, commandStr string, args []strin
return handleStashPopErr(usage, err)
}
ret := commands.StatusCmd{}.Exec(ctx, "status", []string{}, dEnv)
ret := commands.StatusCmd{}.Exec(ctx, "status", []string{}, dEnv, nil)
if ret != 0 || !success {
cli.Println("The stash entry is kept in case you need it again.")
return 1

View File

@@ -88,7 +88,7 @@ func (cmd StashCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd StashCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd StashCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
if !dEnv.DoltDB.Format().UsesFlatbuffers() {
cli.PrintErrln(ErrStashNotSupportedForOldFormat.Error())
return 1

View File

@@ -61,7 +61,7 @@ func (cmd StatusCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd StatusCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd StatusCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, _ := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, statusDocs, ap))
cli.ParseArgsOrDie(ap, args, help)

View File

@@ -71,7 +71,7 @@ func (cmd TagCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd TagCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd TagCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cli.CreateTagArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, tagDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

View File

@@ -70,7 +70,7 @@ func (cmd CpCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd CpCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd CpCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, tblCpDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
@@ -94,5 +94,5 @@ func (cmd CpCmd) Exec(ctx context.Context, commandStr string, args []string, dEn
fmt.Sprintf("--%s", commands.BatchFlag),
fmt.Sprintf(`--%s`, commands.QueryFlag),
queryStr,
}, dEnv)
}, dEnv, nil)
}

View File

@@ -185,7 +185,7 @@ func (cmd ExportCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd ExportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ExportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
_, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, exportDocs, ap))

View File

@@ -372,7 +372,7 @@ func (cmd ImportCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, importDocs, ap))

View File

@@ -72,7 +72,7 @@ func (cmd MvCmd) EventType() eventsapi.ClientEventType {
}
// Exec executes the command
func (cmd MvCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd MvCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, tblMvDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
@@ -95,5 +95,5 @@ func (cmd MvCmd) Exec(ctx context.Context, commandStr string, args []string, dEn
fmt.Sprintf("--%s", commands.BatchFlag),
fmt.Sprintf(`--%s`, commands.QueryFlag),
queryStr,
}, dEnv)
}, dEnv, nil)
}

View File

@@ -66,7 +66,7 @@ func (cmd RmCmd) ArgParser() *argparser.ArgParser {
}
// Exec executes the command
func (cmd RmCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd RmCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
ap := cmd.ArgParser()
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, tblRmDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
@@ -93,5 +93,5 @@ func (cmd RmCmd) Exec(ctx context.Context, commandStr string, args []string, dEn
fmt.Sprintf("--%s", commands.BatchFlag),
fmt.Sprintf(`--%s`, commands.QueryFlag),
queryStr,
}, dEnv)
}, dEnv, nil)
}

View File

@@ -60,7 +60,7 @@ func (cmd VersionCmd) ArgParser() *argparser.ArgParser {
// Version displays the version of the running dolt client
// Exec executes the command
func (cmd VersionCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {
func (cmd VersionCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx *cli.CliContext) int {
cli.Println("dolt version", cmd.VersionStr)
if dEnv.HasDoltDir() && dEnv.RSLoadErr == nil && !cli.CheckEnvIsValid(dEnv) {

View File

@@ -403,7 +403,7 @@ func runMain() int {
start := time.Now()
ctx, stop := context.WithCancel(ctx)
res := doltCommand.Exec(ctx, "dolt", args, dEnv)
res := doltCommand.Exec(ctx, "dolt", args, dEnv, nil)
stop()
if err = dbfactory.CloseAllLocalDatabases(); err != nil {
@@ -464,5 +464,5 @@ func interceptSendMetrics(ctx context.Context, args []string) (bool, int) {
return false, 0
}
dEnv := env.LoadWithoutDB(ctx, env.GetCurrentUserHomeDir, filesys.LocalFS, Version)
return true, doltCommand.Exec(ctx, "dolt", args, dEnv)
return true, doltCommand.Exec(ctx, "dolt", args, dEnv, nil)
}

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type AddressMap struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type Blob struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type BranchControl struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type Commit struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type CommitClosure struct {

View File

@@ -18,7 +18,7 @@ import (
"encoding/binary"
"unsafe"
fb "github.com/google/flatbuffers/go"
fb "github.com/dolthub/flatbuffers/v23/go"
)
// KEEP THESE IN SYNC WITH .fbs FILES!

View File

@@ -19,7 +19,7 @@ package serial
import (
"strconv"
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type ForeignKeyReferentialAction byte

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type MergeArtifacts struct {

View File

@@ -19,7 +19,7 @@ package serial
import (
"strconv"
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type ItemType byte

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type RootValue struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type TableSchema struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type Stash struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type StashList struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type StoreRoot struct {

View File

@@ -17,7 +17,7 @@
package serial
import (
flatbuffers "github.com/google/flatbuffers/go"
flatbuffers "github.com/dolthub/flatbuffers/v23/go"
)
type Table struct {

Some files were not shown because too many files have changed in this diff Show More