Deleted unused file

This commit is contained in:
Zach Musgrave
2023-04-26 12:52:11 -07:00
parent 0338ecc5b8
commit d195e6cef4
4 changed files with 33 additions and 80 deletions
-9
View File
@@ -305,15 +305,6 @@ func getCommitValForRefStrByNomsRoot(ctx context.Context, ddb *DoltDB, ref strin
return datas.LoadCommitAddr(ctx, ddb.vrw, *commitHash)
}
func getCommitValForHash(ctx context.Context, vr types.ValueReader, c string) (*datas.Commit, error) {
unprefixed := strings.TrimPrefix(c, "#")
hash, ok := hash.MaybeParse(unprefixed)
if !ok {
return nil, errors.New("invalid hash: " + c)
}
return datas.LoadCommitAddr(ctx, vr, hash)
}
// Roots is a convenience struct to package up the three roots that most library functions will need to inspect and
// modify the working set. This struct is designed to be passed by value always: functions should take a Roots as a
// param and return a modified one.
@@ -391,13 +391,16 @@ func createMergeSpec(ctx *sql.Context, sess *dsess.DoltSession, dbName string, a
if err != nil {
return nil, err
}
debugPrint(ctx, mergeSpec)
return mergeSpec, nil
}
// TODO NEXT: add debug options to make timing of commits deterministic
func debugPrint(mergeSpec *merge.MergeSpec) {
fmt.Println("MergeH: ", mergeSpec.MergeH.String())
fmt.Println("HeadH: ", mergeSpec.HeadH.String())
func debugPrint(ctx *sql.Context, mergeSpec *merge.MergeSpec) {
ctx.GetLogger().Warnf("MergeH: %s", mergeSpec.MergeH.String())
ctx.GetLogger().Warnf("HeadH: %s", mergeSpec.HeadH.String())
}
// TODO: this copied from commands/merge.go because the latter isn't reusable. Fix that.
@@ -19,7 +19,9 @@ import (
"fmt"
"os"
"testing"
"time"
"github.com/dolthub/dolt/go/store/datas"
gms "github.com/dolthub/go-mysql-server"
"github.com/dolthub/go-mysql-server/enginetest"
"github.com/dolthub/go-mysql-server/enginetest/queries"
@@ -1416,11 +1418,36 @@ func TestDoltRemote(t *testing.T) {
}
}
type testCommitClock struct {
unixNano int64
}
func (tcc *testCommitClock) Now() time.Time {
now := time.Unix(0, tcc.unixNano)
tcc.unixNano += int64(time.Hour)
return now
}
func installTestCommitClock() func() {
oldNowFunc := datas.CommitNowFunc
oldCommitLoc := datas.CommitLoc
tcc := &testCommitClock{}
datas.CommitNowFunc = tcc.Now
datas.CommitLoc = time.UTC
return func() {
datas.CommitNowFunc = oldNowFunc
datas.CommitLoc = oldCommitLoc
}
}
// TestSingleTransactionScript is a convenience method for debugging a single transaction test. Unskip and set to the
// desired test.
func TestSingleTransactionScript(t *testing.T) {
// t.Skip()
f := installTestCommitClock()
defer f()
script := queries.TransactionTest{
Name: "committed conflicts are seen by other sessions",
SetUpScript: []string{
-68
View File
@@ -1,68 +0,0 @@
// Copyright 2019 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.
//
// This file incorporates work covered by the following copyright and
// permission notice:
//
// Copyright 2016 Attic Labs, Inc. All rights reserved.
// Licensed under the Apache License, version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0
package spec
import (
"context"
"fmt"
"time"
flag "github.com/juju/gnuflag"
"github.com/dolthub/dolt/go/store/datas"
)
const CommitMetaDateFormat = time.RFC3339
var (
commitMetaDate string
commitMetaMessage string
)
// RegisterCommitMetaFlags registers command line flags used for creating commit meta structs.
func RegisterCommitMetaFlags(flags *flag.FlagSet) {
flags.StringVar(&commitMetaDate, "date", "", "date for a new commit. '<date>' must be iso8601-formatted. If '<date>' is empty, it defaults to the current date.")
flags.StringVar(&commitMetaMessage, "message", "", "message for a new commit.")
}
// Return the CommitMeta for an invocation of `noms` with CLI flags.
func CommitMetaFromFlags(ctx context.Context) (*datas.CommitMeta, error) {
date := commitMetaDate
t := time.Now().UTC()
var usertime time.Time
if date == "" {
usertime = t
} else {
var err error
usertime, err = time.Parse(CommitMetaDateFormat, date)
if err != nil {
return nil, fmt.Errorf("unable to parse date: %s, error: %s", date, err)
}
}
return &datas.CommitMeta{
UserTimestamp: usertime.UnixMilli(),
Timestamp: uint64(t.UnixMilli()),
Description: commitMetaMessage,
}, nil
}