Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Changes.MoveChange #81

Merged
merged 1 commit into from
Dec 31, 2020
Merged
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ type CommentInput struct {
Message string `json:"message,omitempty"`
}

// MoveInput entity contains information for moving a change.
type MoveInput struct {
DestinationBranch string `json:"destination_branch"`
Message string `json:"message,omitempty"`
KeepAllLabels bool `json:"keep_all_labels"`
}

// RobotCommentInput entity contains information for creating an inline robot comment.
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#robot-comment-input
type RobotCommentInput struct {
Expand Down Expand Up @@ -877,3 +884,14 @@ func (s *ChangesService) RestoreChange(changeID string, input *RestoreInput) (*C
func (s *ChangesService) RevertChange(changeID string, input *RevertInput) (*ChangeInfo, *Response, error) {
return s.change("revert", changeID, input)
}

// MoveChange moves a change.
//
// The destination branch must be provided in the request body inside a MoveInput entity.
// Only veto votes that are blocking the change from submission are moved to the destination
// branch by default.
//
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#move-change
func (s *ChangesService) MoveChange(changeID string, input *MoveInput) (*ChangeInfo, *Response, error) {
return s.change("move", changeID, input)
}