update dolt commit helper functions to remove dEnv

This commit is contained in:
Stephanie You
2023-06-07 15:09:38 -07:00
parent 950d7388c3
commit a8a40e6468
3 changed files with 11 additions and 11 deletions

View File

@@ -100,7 +100,7 @@ func (cmd CommitCmd) Exec(ctx context.Context, commandStr string, args []string,
func performCommit(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx cli.CliContext) (int, bool) {
_, sqlCtx, closeFunc, err := cliCtx.QueryEngine(ctx)
if err != nil {
iohelp.WriteLine(cli.CliOut, err.Error())
cli.Println(err.Error())
return 1, false
}
if closeFunc != nil {
@@ -109,7 +109,7 @@ func performCommit(ctx context.Context, commandStr string, args []string, dEnv *
err = branch_control.CheckAccess(sqlCtx, branch_control.Permissions_Write)
if err != nil {
iohelp.WriteLine(cli.CliOut, err.Error())
cli.Println(err.Error())
return 1, false
}
dbName := sqlCtx.GetCurrentDatabase()
@@ -128,7 +128,7 @@ func performCommit(ctx context.Context, commandStr string, args []string, dEnv *
dSess := dsess.DSessFromSess(sqlCtx.Session)
roots, ok := dSess.GetRoots(sqlCtx, dbName)
if !ok {
iohelp.WriteLine(cli.CliOut, fmt.Sprintf("Could not load database %s", dbName))
cli.Println(fmt.Sprintf("Could not load database %s", dbName))
return 1, false
}
@@ -237,6 +237,7 @@ func performCommit(ctx context.Context, commandStr string, args []string, dEnv *
Date: t,
AllowEmpty: apr.Contains(cli.AllowEmptyFlag) || apr.Contains(cli.AmendFlag),
SkipEmpty: apr.Contains(cli.SkipEmptyFlag),
Amend: apr.Contains(cli.AmendFlag),
Force: apr.Contains(cli.ForceFlag),
Name: name,
Email: email,

View File

@@ -21,18 +21,18 @@ import (
"sort"
"strconv"
"github.com/dolthub/dolt/go/libraries/utils/iohelp"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
eventsapi "github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/utils/argparser"
"github.com/dolthub/go-mysql-server/sql"
"github.com/fatih/color"
"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/cmd/dolt/errhand"
eventsapi "github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi/v1alpha1"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/doltcore/env/actions"
"github.com/dolthub/dolt/go/libraries/doltcore/merge"
"github.com/dolthub/dolt/go/libraries/utils/argparser"
"github.com/dolthub/dolt/go/libraries/utils/set"
"github.com/dolthub/dolt/go/store/datas"
)
@@ -83,7 +83,7 @@ func (cmd MergeCmd) EventType() eventsapi.ClientEventType {
func (cmd MergeCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx cli.CliContext) int {
_, sqlCtx, closeFunc, err := cliCtx.QueryEngine(ctx)
if err != nil {
iohelp.WriteLine(cli.CliOut, err.Error())
cli.Println(err.Error())
return 1
}
if closeFunc != nil {

View File

@@ -27,7 +27,6 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/merge"
"github.com/dolthub/dolt/go/libraries/doltcore/ref"
"github.com/dolthub/dolt/go/libraries/utils/argparser"
"github.com/dolthub/dolt/go/libraries/utils/iohelp"
"github.com/dolthub/dolt/go/store/datas"
"github.com/dolthub/go-mysql-server/sql"
)
@@ -73,7 +72,7 @@ func (cmd PullCmd) EventType() eventsapi.ClientEventType {
func (cmd PullCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx cli.CliContext) int {
_, sqlCtx, closeFunc, err := cliCtx.QueryEngine(ctx)
if err != nil {
iohelp.WriteLine(cli.CliOut, err.Error())
cli.Println(err.Error())
return 1
}
if closeFunc != nil {