1package git2go
2
3import (
4	"context"
5	"time"
6
7	"gitlab.com/gitlab-org/gitaly/v14/internal/git"
8	"gitlab.com/gitlab-org/gitaly/v14/internal/git/repository"
9)
10
11// RevertCommand contains parameters required to execute a revert via gitaly-git2go.
12type RevertCommand struct {
13	// Repository is the path to execute the revert in.
14	Repository string `json:"repository"`
15	// AuthorName is the author name of revert commit.
16	AuthorName string `json:"author_name"`
17	// AuthorMail is the author mail of revert commit.
18	AuthorMail string `json:"author_mail"`
19	// AuthorDate is the author date of revert commit.
20	AuthorDate time.Time `json:"author_date"`
21	// Message is the message to be used for the revert commit.
22	Message string `json:"message"`
23	// Ours is the commit that the revert is applied to.
24	Ours string `json:"ours"`
25	// Revert is the commit to be reverted.
26	Revert string `json:"revert"`
27	// Mainline is the parent to be considered the mainline
28	Mainline uint `json:"mainline"`
29}
30
31// Revert reverts a commit via gitaly-git2go.
32func (b Executor) Revert(ctx context.Context, repo repository.GitRepo, r RevertCommand) (git.ObjectID, error) {
33	return b.runWithGob(ctx, repo, "revert", r)
34}
35