Merge Request
To interact with merge requests, the mergeRequestService
object is defined.
The merge request entity contains the following data:
class MergeRequest {...}
Name | Data Type | Description |
---|---|---|
id |
string | Merge request UUID |
localId |
number | Local number of the merge request |
authorId |
string | UUID of the merge request author |
targetProjectId |
string | UUID of the target project of the merge request |
targetBranch |
string | Target branch of the merge request |
targetCommit |
string | Target commit hash of the merge request |
sourceProjectId |
string | UUID of the source project of the merge request |
sourceBranch |
string | Source branch of the merge request |
sourceCommit |
string | Source commit hash of the merge request |
title |
string | Title of the merge request |
description |
string | Description of the merge request |
removeSourceBranch |
boolean | Delete source branch after merging: true or not: false |
squashCommit |
boolean | Perform squash merge: true or not: false |
status |
string | Merge request status. Possible values: OPENED , MERGED , FAILED , CONFLICT , CANCELED , CLOSED , FAST_FORWARD_MERGED , TRAINS_CAR_CONFLICT , TRAINS_CAR_CREATED |
mergeCommit |
string | Merge commit hash |
workInProgress |
boolean | Merge request is blocked: true or not: false |
workInProgressReason |
string | Reason for blocking the merge request |
Methods for Working with Merge Requests
The following methods exist for working with the merge request entity:
Creating a Merge Request
mergeRequestService.create(toCreate: MergeRequest) => MergeRequest
This method creates a merge request and returns it. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
targetProjectId |
string | UUID of the target project of the merge request |
sourceProjectId |
string | UUID of the source project of the merge request |
targetBranch |
string | Target branch of the merge request |
sourceBranch |
string | Source branch of the merge request |
title |
string | Title of the merge request |
description |
string | Description of the merge request |
removeSourceBranch |
boolean | Optional. Delete source branch after merging: true or not: false (default) |
squashCommit |
boolean | Optional. Perform squash merge: true or not: false (default) |
workInProgress |
boolean | Optional. Merge request is blocked: true or not: false (default) |
workInProgressReason |
string | Optional. Reason for blocking the merge request |
Editing a Merge Request
mergeRequestService.edit(toEdit: MergeRequest) => MergeRequest
This method edits a merge request and returns it. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
id |
string | Merge request UUID |
targetBranch |
string | Optional. Target branch of the merge request |
sourceBranch |
string | Optional. Source branch of the merge request |
title |
string | Optional. Title of the merge request |
description |
string | Optional. Description of the merge request |
removeSourceBranch |
boolean | Optional. Delete source branch after merging: true or not: false |
squashCommit |
boolean | Optional. Perform squash merge: true or not: false |
workInProgress |
boolean | Optional. Merge request is blocked: true or not: false |
workInProgressReason |
string | Optional. Reason for blocking the merge request |
Editing Merge Request Status
mergeRequestService.editStatus({mergeRequestId}, {newStatus}) => MergeRequest
This method changes the status and returns the merge request. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
mergeRequestId |
string | UUID of the merge request whose status will be changed |
newStatus |
string | New status. Possible values: OPENED , MERGED , FAILED , CONFLICT , CANCELED , CLOSED , FAST_FORWARD_MERGED , TRAINS_CAR_CONFLICT , TRAINS_CAR_CREATED |
Getting a List of Merge Requests by Source Project
mergeRequestService.findAllBySourceProject({projectId}, {startPage}, {pageSize}) => Page<MergeRequest>
This method returns an object with merge requests where the specified project is the source. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
projectId |
string | Source project UUID |
startPage |
number | Requested page number |
pageSize |
number | Page size |
Getting a List of Merge Requests by Target Project
mergeRequestService.findAllByTargetProject({projectId}, {startPage}, {pageSize}) => Page<MergeRequest>
This method returns an object with merge requests where the specified project is the target. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
projectId |
string | Target project UUID |
startPage |
number | Requested page number |
pageSize |
number | Page size |
Finding a Merge Request by UUID
mergeRequestService.findById({id}) => MergeRequest
This method returns the merge request by the specified UUID. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
id |
string | Merge request UUID |
Finding a Merge Request by Local Number
mergeRequestService.findByLocalId({localId}, {projectId}) => MergeRequest
This method returns the merge request with the specified number in the project. You need to provide the following values:
To get a merge request created from a fork, specify the fork's UUID in the
projectId
field
Name | Data Type | Description |
---|---|---|
localId |
number | Local number of the merge request |
projectId |
string | Project UUID to search in |
Checking if a Merge Request Exists
mergeRequestService.exists({sourceProjectUuid}, {sourceBranch}, {targetProjectUuid}, {targetBranch}) => boolean
This method returns true
if the merge request exists and false
if not. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
sourceProjectUuid |
string | Source project UUID |
sourceBranch |
string | Source branch |
targetProjectUuid |
string | Target project UUID |
targetBranch |
string | Target branch |
Checking if a Merge Request Can Be Merged
mergeRequestService.canMerge({id}) => boolean
This method returns true
if the merge request can be merged and false
if not. You need to provide the following values:
Name | Data Type | Description |
---|---|---|
id |
string | Merge request UUID |
Automated translation!
This page was translated using automatic translation tools. The text may contain inaccuracies.