# dev.knotless.revertPull

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

Reverts a merged pull as the account logged in to this appview's pages.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.revertPull)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.revertPull/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.revertPull/examples)

## Definitions

### `dev.knotless.revertPull`

**Type**: `procedure`

Reverts a merged pull as `knotless revert` does, as the account logged in to this appview's web pages, with the session the appview keeps for it: one commit undoing what its merge brought in, on a new branch revert/<the pull's record key> cut from its target branch as it is now, and a pull of that branch into the target branch, which this answers. Nothing merges: the revert is a pull like any other. Refused on a pull that is not merged, when undoing it conflicts with what the branch took since, and to anyone but the repository's owner and collaborators. Requires the session cookie the pages' login sets.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `pull` | `string` (at-uri) | Yes | The merged dev.knotless.pull record. |
| `reason` | `string` | No | Why, said in the revert's body. |
| `repo` | `string` (at-uri) | Yes | The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `branch` | `string` | Yes | The branch holding the revert, without refs/heads/. |
| `commit` | `string` | Yes | The revert's commit, in hex. |
| `uri` | `string` (at-uri) | Yes | The new dev.knotless.pull record, which brings the revert in. |

#### Errors

- **NotFound**: No such repository.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.
- **UpstreamFailure**: It did not revert, as the reason says: the pull is not merged, undoing it conflicts, or the account may not revert it.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Reverts a merged pull as `knotless revert` does, as the account logged in to this appview's web pages, with the session the appview keeps for it: one commit undoing what its merge brought in, on a new branch revert/<the pull's record key> cut from its target branch as it is now, and a pull of that branch into the target branch, which this answers. Nothing merges: the revert is a pull like any other. Refused on a pull that is not merged, when undoing it conflicts with what the branch took since, and to anyone but the repository's owner and collaborators. Requires the session cookie the pages' login sets.",
      "errors": [
        {
          "description": "No such repository.",
          "name": "NotFound"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        },
        {
          "description": "It did not revert, as the reason says: the pull is not merged, undoing it conflicts, or the account may not revert it.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "pull": {
              "description": "The merged dev.knotless.pull record.",
              "format": "at-uri",
              "type": "string"
            },
            "reason": {
              "description": "Why, said in the revert's body.",
              "maxGraphemes": 1000,
              "maxLength": 10000,
              "type": "string"
            },
            "repo": {
              "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "repo",
            "pull"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "branch": {
              "description": "The branch holding the revert, without refs/heads/.",
              "type": "string"
            },
            "commit": {
              "description": "The revert's commit, in hex.",
              "type": "string"
            },
            "uri": {
              "description": "The new dev.knotless.pull record, which brings the revert in.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "branch",
            "commit"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Reverts a merged pull as the account logged in to this appview's pages.",
  "id": "dev.knotless.revertPull",
  "lexicon": 1
}
```
