Skip to content

Commit

Permalink
[CR] Add "--merge" option to "lakectl merge"
Browse files Browse the repository at this point in the history
  • Loading branch information
arielshaqed committed Jan 6, 2025
1 parent 9ca1331 commit 54dbde3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/lakectl/cmd/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var mergeCmd = &cobra.Command{
strategy := Must(cmd.Flags().GetString("strategy"))
force := Must(cmd.Flags().GetBool("force"))
allowEmpty := Must(cmd.Flags().GetBool("allow-empty"))
squash := Must(cmd.Flags().GetBool("squash"))

fmt.Println("Source:", sourceRef)
fmt.Println("Destination:", destinationRef)
Expand All @@ -54,11 +55,12 @@ var mergeCmd = &cobra.Command{
}

body := apigen.MergeIntoBranchJSONRequestBody{
Message: &message,
Metadata: &apigen.Merge_Metadata{AdditionalProperties: kvPairs},
Strategy: &strategy,
Force: &force,
AllowEmpty: &allowEmpty,
Message: &message,
Metadata: &apigen.Merge_Metadata{AdditionalProperties: kvPairs},
Strategy: &strategy,
Force: &force,
AllowEmpty: &allowEmpty,
SquashMerge: &squash,
}

resp, err := client.MergeIntoBranchWithResponse(cmd.Context(), destinationRef.Repository, sourceRef.Ref, destinationRef.Ref, body)
Expand Down Expand Up @@ -89,6 +91,7 @@ func init() {
flags.String("strategy", "", "In case of a merge conflict, this option will force the merge process to automatically favor changes from the dest branch (\"dest-wins\") or from the source branch(\"source-wins\"). In case no selection is made, the merge process will fail in case of a conflict")
flags.Bool("force", false, "Allow merge into a read-only branch or into a branch with the same content")
flags.Bool("allow-empty", false, "Allow merge when the branches have the same content")
flags.Bool("squash", false, "Squash all changes from source into a single commit on destination")
withCommitFlags(mergeCmd, true)
rootCmd.AddCommand(mergeCmd)
}

0 comments on commit 54dbde3

Please sign in to comment.