Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7785467
Very messy first pass on getting a dolt_rebase stored procedure start…
fulghum Nov 14, 2023
89f66fa
Prototyping the dolt_rebase table contents
fulghum Nov 15, 2023
2967722
Messy first pass at cherry-picking rebased commits; currently applies…
fulghum Nov 16, 2023
0843c23
Next pass on rebase – uses a temporary rebase branch (instead of work…
fulghum Nov 16, 2023
a74c7c3
Minor cleanup
fulghum Nov 16, 2023
67f25e4
Making the dolt_rebase table updatable
fulghum Nov 16, 2023
133bc4a
Undo'ing some hacks and adding support for the "skip" rebase action
fulghum Nov 16, 2023
0b170be
Adding tests for the skip rebase action and fixing a working set root…
fulghum Nov 17, 2023
f360392
Starting rebase arg parser support
fulghum Nov 17, 2023
921d9dd
Hacking together a prototype of rebase support for the squash action
fulghum Nov 17, 2023
f73798b
Small step towards pulling out the rebase upstream branch parameter
fulghum Nov 20, 2023
8336121
Switching to take in the upstream branch for the rebase operation
fulghum Nov 20, 2023
07f81b7
Updating rebase test to specify work using a specified upstream branch
fulghum Nov 20, 2023
a3ac446
First pass at refactoring tests
fulghum Nov 20, 2023
3ee612b
Making the dolt_rebase table always ignored, so that it can't be chec…
fulghum Nov 21, 2023
c33a342
Adding support for squashing commit messages
fulghum Nov 21, 2023
3aa6176
Cleaning up an old hack
fulghum Nov 21, 2023
d6a390e
Refactoring core cherry pick logic out of the dprocedure package and …
fulghum Dec 6, 2023
cf4cdb8
rebase implementation comments
fulghum Dec 6, 2023
174e4da
Cleaning up cherry-pick hack and moving to refactored cherry-pick API
fulghum Dec 6, 2023
e9173fc
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 6, 2023
ca35f83
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 14, 2023
84602f0
Adding support for the reword rebase action
fulghum Dec 14, 2023
0c2ca2c
Fixing "drop" rebase action name
fulghum Dec 14, 2023
f11fcd6
Renaming rebsae.go -> filter_branch.go
fulghum Dec 14, 2023
ec622f5
Clearing rebase state on reset
fulghum Dec 15, 2023
4956177
First pass at cleaning up Git-logic/SQL-logic interface for rebase, s…
fulghum Dec 15, 2023
8e614f9
Removing hardcoded working rebase branch name
fulghum Dec 15, 2023
d1bb9d0
Cleaning up branch creation
fulghum Dec 15, 2023
160b27a
Cleaning up rebase action processing
fulghum Dec 15, 2023
455cbc3
Splitting out logic for loading the rebase plan from the database and…
fulghum Dec 15, 2023
58473e7
Adding support for the fixup rebase action
fulghum Dec 15, 2023
09212d2
Adding a rebase plan validation step and drafting out more test cases
fulghum Dec 15, 2023
3a6ca24
Adding more tests and validation
fulghum Dec 16, 2023
da85f43
Renaming RebaseableDatabase to RebasePlanDatabase
fulghum Dec 16, 2023
326b918
Cleaning up RebasePlanDatabase package organization
fulghum Dec 16, 2023
23ca984
Cleaning up RebasePlanDatabase package organization
fulghum Dec 16, 2023
8cf516b
Merge branch 'fulghum/rebase-prototype' of https://github.com/dolthub…
fulghum Dec 18, 2023
d2f555c
Tidying up
fulghum Dec 18, 2023
3982803
Switch to arg parser
fulghum Dec 18, 2023
087b5c6
Adding more rebase plan validation logic/tests
fulghum Dec 18, 2023
fd6a8c3
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 18, 2023
b45b2a7
Adding rebase.go back after it got removed during a merge of a refact…
fulghum Dec 18, 2023
23c330b
Tidying up arg parser
fulghum Dec 18, 2023
26b202b
Changing rebase_order to be a DECIMAL(6,2) type to make it easier to …
fulghum Dec 18, 2023
6d1e3e5
Reverting some noms hacks in dataset.go
fulghum Dec 18, 2023
87e5a34
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 18, 2023
ede4822
Regenerating worksingset flatbuffer code, after picking up git submod…
fulghum Dec 18, 2023
edc3258
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
fulghum Dec 18, 2023
708d050
Tidying up
fulghum Dec 18, 2023
f41cca4
Fixing abort to properly clean up all rebase state, and adding tests
fulghum Dec 19, 2023
69f8161
Adding a human-readable status message to dolt_rebase's response
fulghum Dec 19, 2023
9c00d76
Adding a test for working rebase branch deletion on successful rebase…
fulghum Dec 19, 2023
25ef828
Merge branch 'fulghum/rebase-prototype' of https://github.com/dolthub…
fulghum Dec 19, 2023
9ecebf3
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 19, 2023
3a5f6c5
Updating expected values to enum string value, after picking up test …
fulghum Dec 19, 2023
d52e454
Tidying up
fulghum Dec 19, 2023
03ec848
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 19, 2023
38c76a5
Tidying up
fulghum Dec 20, 2023
5b7387b
Detecting data and schema conflicts, aborting the rebase, and returni…
fulghum Dec 20, 2023
cc95085
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
fulghum Dec 20, 2023
40494a7
Cleaning up cherry-pick interface for amending a previous commit with…
fulghum Dec 20, 2023
a77c65b
Adding tests for rebasing over merge commits, and more error cases
fulghum Dec 20, 2023
5169978
Detecting if a branch being rebased has been changed by another sessi…
fulghum Dec 21, 2023
d7f374c
Merge branch 'fulghum/rebase-prototype' of https://github.com/dolthub…
fulghum Dec 21, 2023
335621d
Cleaning up naming
fulghum Dec 21, 2023
7fda72a
Adding more tests to cover non-standard plan updates (e.g. removing r…
fulghum Dec 21, 2023
54a50d5
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 27, 2023
426df4a
Fixing workingset_flatbuffer calls after picking up changes from main
fulghum Dec 27, 2023
bb65111
Removing skip now that GMS is patched and this test will run correctly
fulghum Dec 28, 2023
e91432e
Merge branch 'main' into fulghum/rebase-prototype
fulghum Dec 29, 2023
ca5c0de
Simplifying the five return params into two for WorkingSet.writeValues
fulghum Dec 29, 2023
02ae1c5
Adding a TODO about a race condition in the copyABranch function used…
fulghum Dec 29, 2023
3ada516
Adding more info to the human-readable status message returned from d…
fulghum Dec 29, 2023
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
11 changes: 11 additions & 0 deletions go/cmd/dolt/cli/arg_parser_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ func CreateMergeArgParser() *argparser.ArgParser {
return ap
}

func CreateRebaseArgParser() *argparser.ArgParser {
ap := argparser.NewArgParserWithMaxArgs("merge", 1)
ap.TooManyArgsErrorFunc = func(receivedArgs []string) error {
return fmt.Errorf("rebase takes at most one positional argument.")
}
ap.SupportsFlag(AbortParam, "", "Abort an interactive rebase and return the working set to the pre-rebase state")
ap.SupportsFlag(ContinueFlag, "", "Continue an interactive rebase after adjusting the rebase plan")
ap.SupportsFlag(InteractiveFlag, "i", "Start an interactive rebase")
return ap
}

func CreatePushArgParser() *argparser.ArgParser {
ap := argparser.NewArgParserWithVariableArgs("push")
ap.SupportsString(UserFlag, "", "user", "User name to use when authenticating with the remote. Gets password from the environment variable {{.EmphasisLeft}}DOLT_REMOTE_PASSWORD{{.EmphasisRight}}.")
Expand Down
2 changes: 2 additions & 0 deletions go/cmd/dolt/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
CheckoutCreateBranch = "b"
CreateResetBranch = "B"
CommitFlag = "commit"
ContinueFlag = "continue"
CopyFlag = "copy"
DateParam = "date"
DecorateFlag = "decorate"
Expand All @@ -36,6 +37,7 @@ const (
ForceFlag = "force"
HardResetParam = "hard"
HostFlag = "host"
InteractiveFlag = "interactive"
ListFlag = "list"
MergesFlag = "merges"
MessageArg = "message"
Expand Down
182 changes: 181 additions & 1 deletion go/gen/fb/serial/workingset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions go/libraries/doltcore/cherry_pick/cherry_pick.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ func CherryPick(ctx *sql.Context, commit string, options CherryPickOptions) (str

mergeResult, commitMsg, err := cherryPick(ctx, doltSession, roots, dbName, commit)
if err != nil {
return "", nil, err
return "", mergeResult, err
}

// If we're amending the previous commit and a new commit message hasn't been provided,
// grab the previous commit message and reuse it.
if options.Amend && options.CommitMessage == "" {
commitMsg, err = previousCommitMessage(ctx)
if err != nil {
return "", nil, err
}
}

newWorkingRoot := mergeResult.Root
Expand Down Expand Up @@ -113,6 +122,20 @@ func CherryPick(ctx *sql.Context, commit string, options CherryPickOptions) (str
return h.String(), nil, nil
}

func previousCommitMessage(ctx *sql.Context) (string, error) {
doltSession := dsess.DSessFromSess(ctx.Session)
headCommit, err := doltSession.GetHeadCommit(ctx, ctx.GetCurrentDatabase())
if err != nil {
return "", err
}
headCommitMeta, err := headCommit.GetCommitMeta(ctx)
if err != nil {
return "", err
}

return headCommitMeta.Description, nil
}

// AbortCherryPick aborts a cherry-pick merge, if one is in progress. If unable to abort for any reason
// (e.g. if there is not cherry-pick merge in progress), an error is returned.
func AbortCherryPick(ctx *sql.Context, dbName string) error {
Expand Down Expand Up @@ -222,7 +245,7 @@ func cherryPick(ctx *sql.Context, dSess *dsess.DoltSession, roots doltdb.Roots,
}
result, err := merge.MergeRoots(ctx, roots.Working, cherryRoot, parentRoot, cherryCommit, parentCommit, dbState.EditOpts(), mo)
if err != nil {
return nil, "", err
return result, "", err
}

workingRootHash, err = result.Root.HashOf()
Expand Down
20 changes: 4 additions & 16 deletions go/libraries/doltcore/doltdb/doltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1302,18 +1302,12 @@ func (ddb *DoltDB) UpdateWorkingSet(
return err
}

workingRootRef, stagedRef, mergeState, err := workingSet.writeValues(ctx, ddb)
wsSpec, err := workingSet.writeValues(ctx, ddb, meta)
if err != nil {
return err
}

_, err = ddb.db.withReplicationStatusController(replicationStatus).UpdateWorkingSet(ctx, ds, datas.WorkingSetSpec{
Meta: meta,
WorkingRoot: workingRootRef,
StagedRoot: stagedRef,
MergeState: mergeState,
}, prevHash)

_, err = ddb.db.withReplicationStatusController(replicationStatus).UpdateWorkingSet(ctx, ds, *wsSpec, prevHash)
return err
}

Expand All @@ -1339,19 +1333,13 @@ func (ddb *DoltDB) CommitWithWorkingSet(
return nil, err
}

workingRootRef, stagedRef, mergeState, err := workingSet.writeValues(ctx, ddb)
wsSpec, err := workingSet.writeValues(ctx, ddb, meta)
if err != nil {
return nil, err
}

commitDataset, _, err := ddb.db.withReplicationStatusController(replicationStatus).
CommitWithWorkingSet(ctx, headDs, wsDs, commit.Roots.Staged.nomsValue(), datas.WorkingSetSpec{
Meta: meta,
WorkingRoot: workingRootRef,
StagedRoot: stagedRef,
MergeState: mergeState,
}, prevHash, commit.CommitOptions)

CommitWithWorkingSet(ctx, headDs, wsDs, commit.Roots.Staged.nomsValue(), *wsSpec, prevHash, commit.CommitOptions)
if err != nil {
return nil, err
}
Expand Down
6 changes: 6 additions & 0 deletions go/libraries/doltcore/doltdb/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ func resolveConflictingPatterns(trueMatches, falseMatches []string, tableName st
}

func (ip *IgnorePatterns) IsTableNameIgnored(tableName string) (IgnoreResult, error) {
// The dolt_rebase table is automatically ignored by Dolt – it shouldn't ever
// be checked in to a Dolt database.
if strings.ToLower(tableName) == strings.ToLower(RebaseTableName) {
return Ignore, nil
}

trueMatches := []string{}
falseMatches := []string{}
for _, patternIgnore := range *ip {
Expand Down
4 changes: 4 additions & 0 deletions go/libraries/doltcore/doltdb/system_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ var writeableSystemTables = []string{
SchemasTableName,
ProceduresTableName,
IgnoreTableName,
RebaseTableName,
}

var persistedSystemTables = []string{
Expand Down Expand Up @@ -311,6 +312,9 @@ const (
TagsTableName = "dolt_tags"

IgnoreTableName = "dolt_ignore"

// RebaseTableName is the rebase system table name.
RebaseTableName = "dolt_rebase"
)

const (
Expand Down
Loading