Skip to content

Commit

Permalink
remove unsupported reset-to-commit option (#1946)
Browse files Browse the repository at this point in the history
* remove unsupported reset-to-commit option

* cont

* phrasing

* typo
  • Loading branch information
johnnyaug authored May 12, 2021
1 parent 5e1bde1 commit be53f58
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 73 deletions.
4 changes: 1 addition & 3 deletions api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ components:
properties:
type:
type: string
enum: [ object, common_prefix, commit, reset ]
commit:
type: string
enum: [ object, common_prefix, reset ]
path:
type: string

Expand Down
4 changes: 0 additions & 4 deletions clients/java/api/openapi.yaml

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

2 changes: 0 additions & 2 deletions clients/java/docs/ResetCreation.md

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

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

1 change: 0 additions & 1 deletion clients/python/docs/BranchesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ with lakefs_client.ApiClient(configuration) as api_client:
branch = "branch_example" # str |
reset_creation = ResetCreation(
type="object",
commit="commit_example",
path="path_example",
) # ResetCreation |

Expand Down
1 change: 0 additions & 1 deletion clients/python/docs/ResetCreation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **str** | |
**commit** | **str** | | [optional]
**path** | **str** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
4 changes: 0 additions & 4 deletions clients/python/lakefs_client/model/reset_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class ResetCreation(ModelNormal):
('type',): {
'OBJECT': "object",
'COMMON_PREFIX': "common_prefix",
'COMMIT': "commit",
'RESET': "reset",
},
}
Expand All @@ -80,7 +79,6 @@ def openapi_types():
"""
return {
'type': (str,), # noqa: E501
'commit': (str,), # noqa: E501
'path': (str,), # noqa: E501
}

Expand All @@ -91,7 +89,6 @@ def discriminator():

attribute_map = {
'type': 'type', # noqa: E501
'commit': 'commit', # noqa: E501
'path': 'path', # noqa: E501
}

Expand Down Expand Up @@ -144,7 +141,6 @@ def __init__(self, type, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
commit (str): [optional] # noqa: E501
path (str): [optional] # noqa: E501
"""

Expand Down
22 changes: 5 additions & 17 deletions cmd/lakectl/cmd/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,14 @@ var branchResetCmd = &cobra.Command{
Use: "reset <branch uri> [flags]",
Short: "reset changes to specified commit, or reset uncommitted changes - all changes, or by path",
Long: `reset changes. There are four different ways to reset changes:
1. reset to previous commit, set HEAD of branch to given commit - reset lakefs://myrepo/main --commit commitId
2. reset all uncommitted changes - reset lakefs://myrepo/main
3. reset uncommitted changes under specific path - reset lakefs://myrepo/main --prefix path
4. reset uncommitted changes for specific object - reset lakefs://myrepo/main --object path`,
1. reset all uncommitted changes - reset lakefs://myrepo/main
2. reset uncommitted changes under specific path - reset lakefs://myrepo/main --prefix path
3. reset uncommitted changes for specific object - reset lakefs://myrepo/main --object path`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
clt := getClient()
u := MustParseRefURI("branch", args[0])
Fmt("Branch: %s\n", u.String())
commitID, err := cmd.Flags().GetString("commit")
if err != nil {
DieErr(err)
}
prefix, err := cmd.Flags().GetString("prefix")
if err != nil {
DieErr(err)
Expand All @@ -148,20 +143,14 @@ var branchResetCmd = &cobra.Command{
var reset api.ResetCreation
var confirmationMsg string
switch {
case len(commitID) > 0:
confirmationMsg = fmt.Sprintf("Are you sure you want to reset all changes to commit: %s", commitID)
reset = api.ResetCreation{
Commit: &commitID,
Type: "commit",
}
case len(prefix) > 0:
confirmationMsg = fmt.Sprintf("Are you sure you want to reset all changes from path: %s to last commit", prefix)
confirmationMsg = fmt.Sprintf("Are you sure you want to reset all uncommitted changes from path: %s", prefix)
reset = api.ResetCreation{
Path: &prefix,
Type: "common_prefix",
}
case len(object) > 0:
confirmationMsg = fmt.Sprintf("Are you sure you want to reset all changes for object: %s to last commit", object)
confirmationMsg = fmt.Sprintf("Are you sure you want to reset all uncommitted changes for object: %s", object)
reset = api.ResetCreation{
Path: &object,
Type: "object",
Expand Down Expand Up @@ -214,7 +203,6 @@ func init() {
branchCreateCmd.Flags().StringP("source", "s", "", "source branch uri")
_ = branchCreateCmd.MarkFlagRequired("source")

branchResetCmd.Flags().String("commit", "", "commit ID to reset branch to")
branchResetCmd.Flags().String("prefix", "", "prefix of the objects to be reset")
branchResetCmd.Flags().String("object", "", "path to object to be reset")

Expand Down
2 changes: 0 additions & 2 deletions pkg/api/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1536,8 +1536,6 @@ func (c *Controller) ResetBranch(w http.ResponseWriter, r *http.Request, body Re

var err error
switch body.Type {
case "commit":
err = c.Catalog.RollbackCommit(ctx, repository, branch, StringValue(body.Commit))
case "common_prefix":
err = c.Catalog.ResetEntries(ctx, repository, branch, StringValue(body.Path))
case "reset":
Expand Down
5 changes: 0 additions & 5 deletions pkg/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,6 @@ func (c *Catalog) Revert(ctx context.Context, repository string, branch string,
return err
}

func (c *Catalog) RollbackCommit(_ context.Context, _ string, _ string, _ string) error {
c.log.Debug("rollback to commit is not supported in rocks implementation")
return ErrFeatureNotSupported
}

func (c *Catalog) Diff(ctx context.Context, repository string, leftReference string, rightReference string, params DiffParams) (Differences, bool, error) {
repositoryID := graveler.RepositoryID(repository)
left := graveler.Ref(leftReference)
Expand Down
2 changes: 0 additions & 2 deletions pkg/catalog/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ type Interface interface {
GetCommit(ctx context.Context, repository, reference string) (*CommitLog, error)
ListCommits(ctx context.Context, repository, branch string, fromReference string, limit int) ([]*CommitLog, bool, error)

// RollbackCommit sets the branch to point at the given commit, losing all later commits.
RollbackCommit(ctx context.Context, repository, branch string, reference string) error
// Revert creates a reverse patch to the given commit, and applies it as a new commit on the given branch.
Revert(ctx context.Context, repository, branch string, params RevertParams) error

Expand Down

0 comments on commit be53f58

Please sign in to comment.