OpenFolia

Move a change set onto its rewritten base’s current head

POST
/change-sets/{changeSetId}/rebase

For an open change set whose base branch was rewritten (meta.base.state: "rewritten" on GET /change-sets/{changeSetId}: its base commit is no longer in the base’s history, after a force-push or a restore), which can therefore be neither updated nor merged: starts a new draft change set on the base’s current head, with the same title and description, and applies the change set’s own changes there (its base commit to its branch’s head), three-way. Its working copies are committed first, as a save point, for a draft. Each module, manual, configuration or term it changes is locked for the new change set, and what applied cleanly is committed there as a save point; what did not (a conflict, a lock another change set holds, a subject outside your scope, a file that is no subject) is left as the base has it and listed in meta.rebase.conflicts, with the blocks to apply by hand where it can tell. The old change set is abandoned, superseded by the new one (meta.supersededBy, meta.supersedes); its branch and comments stay readable. Approvals do not carry over. Records change-set.create (with supersedes) on the new change set, and change-set.abandon (with supersededBy) and change-set.rebase on the old one. By its author only (it closes the change set; 403 for anyone else); the new change set is yours too. Moved already: 409 already-superseded, naming the new one in meta.changeSetId.

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Path Parameters

changeSetId*string

The change set’s ID (a UUID). One that names no change set, malformed or not, is 404.

Formatuuid

Header Parameters

X-Ccms-User?string

Demo mode only (CCMS_AUTH_MODE=demo): the user ID to act as. The bearer token is still required; without demo mode the header is refused (400).

Request Body

application/vnd.api+json
  1. body
meta?

Response Body

application/vnd.api+json
  1. response
data*

The new draft change set on the base’s current head (yours), with the same title and description.

meta*
Example Request
curl -X POST 'http://localhost:3000/change-sets/497f6eca-6276-4993-bfeb-53cbbbba6f08/rebase' \  -H 'Content-Type: application/vnd.api+json' \  -d '{}'
Example Response
{  "data": {    "type": "ChangeSet",    "id": "string",    "attributes": {      "title": "string",      "description": "string",      "state": "draft",      "author": {        "kind": "user",        "id": "string"      },      "baseRef": "string",      "baseCommit": "string",      "branch": "string",      "reviewHead": "string",      "mergeCommit": "string",      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    },    "meta": {      "branchMissing": true,      "behind": 0,      "base": {        "state": "current"      },      "supersededBy": "string",      "supersedes": "string"    }  },  "meta": {    "rebase": {      "from": "string",      "commit": "string",      "applied": [        {          "type": "module",          "lang": "string",          "moduleId": "string"        }      ],      "conflicts": [        {          "path": "string",          "subject": {            "type": "module",            "lang": "string",            "moduleId": "string"          },          "kinds": [            "string"          ],          "blockIds": [            "string"          ]        }      ],      "total": -9007199254740991    }  }}