debian-mirror-gitlab/doc/api/merge_request_context_commits.md

100 lines
3.5 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
stage: Create
2021-04-17 20:07:23 +05:30
group: Code Review
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2020-10-24 23:57:45 +05:30
type: reference, api
---
2021-03-11 19:13:27 +05:30
# Merge request context commits API **(FREE)**
2020-03-13 15:44:24 +05:30
## List MR context commits
Get a list of merge request context commits.
2020-04-08 14:13:33 +05:30
```plaintext
2020-03-13 15:44:24 +05:30
GET /projects/:id/merge_requests/:merge_request_iid/context_commits
```
Parameters:
2022-10-11 01:57:18 +05:30
| Attribute | Type | Required | Description |
|---------------------|---------|----------|-------------|
2023-04-23 21:23:45 +05:30
| `id` | integer | **{check-circle}** Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2022-10-11 01:57:18 +05:30
| `merge_request_iid` | integer | **{check-circle}** Yes | The internal ID of the merge request. |
2020-03-13 15:44:24 +05:30
```json
[
{
"id": "4a24d82dbca5c11c61556f3b35ca472b7463187e",
"short_id": "4a24d82d",
"created_at": "2017-04-11T10:08:59.000Z",
"parent_ids": null,
"title": "Update README.md to include `Usage in testing and development`",
"message": "Update README.md to include `Usage in testing and development`",
2020-04-08 14:13:33 +05:30
"author_name": "Example \"Sample\" User",
"author_email": "user@example.com",
2020-03-13 15:44:24 +05:30
"authored_date": "2017-04-11T10:08:59.000Z",
2020-04-08 14:13:33 +05:30
"committer_name": "Example \"Sample\" User",
"committer_email": "user@example.com",
2020-03-13 15:44:24 +05:30
"committed_date": "2017-04-11T10:08:59.000Z"
}
]
```
## Create MR context commits
Create a list of merge request context commits.
2020-04-08 14:13:33 +05:30
```plaintext
2020-03-13 15:44:24 +05:30
POST /projects/:id/merge_requests/:merge_request_iid/context_commits
```
Parameters:
2022-10-11 01:57:18 +05:30
| Attribute | Type | Required | Description |
|---------------------|---------|----------|-------------|
2023-04-23 21:23:45 +05:30
| `id` | integer | **{check-circle}** Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user |
2022-10-11 01:57:18 +05:30
| `merge_request_iid` | integer | **{check-circle}** Yes | The internal ID of the merge request. |
2020-03-13 15:44:24 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2020-03-13 15:44:24 +05:30
POST /projects/:id/merge_requests/
```
2022-10-11 01:57:18 +05:30
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `commits` | string array | **{check-circle}** Yes | The context commits' SHA. |
2020-03-13 15:44:24 +05:30
```json
[
{
"id": "6d394385cf567f80a8fd85055db1ab4c5295806f",
2020-04-08 14:13:33 +05:30
"message": "Added contributing guide\n\nSigned-off-by: Example User <user@example.com>\n",
2020-03-13 15:44:24 +05:30
"parent_ids": [
"1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
],
"authored_date": "2014-02-27T10:05:10.000+02:00",
2020-04-08 14:13:33 +05:30
"author_name": "Example User",
"author_email": "user@example.com",
2020-03-13 15:44:24 +05:30
"committed_date": "2014-02-27T10:05:10.000+02:00",
2020-04-08 14:13:33 +05:30
"committer_name": "Example User",
"committer_email": "user@example.com"
2020-03-13 15:44:24 +05:30
}
]
```
## Delete MR context commits
Delete a list of merge request context commits.
2020-04-08 14:13:33 +05:30
```plaintext
2020-03-13 15:44:24 +05:30
DELETE /projects/:id/merge_requests/:merge_request_iid/context_commits
```
Parameters:
2022-10-11 01:57:18 +05:30
| Attribute | Type | Required | Description |
|---------------------|--------------|----------|--------------|
| `commits` | string array | **{check-circle}** Yes | The context commits' SHA. |
2023-04-23 21:23:45 +05:30
| `id` | integer | **{check-circle}** Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
2022-10-11 01:57:18 +05:30
| `merge_request_iid` | integer | **{check-circle}** Yes | The internal ID of the merge request. |