Open a new slice
Code Mode: praxis.devops.changes.slices.create
HTTP: POST /devops/v1/projects/{project}/changes/{change}/slices
Open one more slice of a change: another pull request on the same change, developed beside the ones already open. Use it when a second piece of the change can be built in parallel; for the change’s first pull request there is nothing to open — work on the branch praxis devops change checkout gave you. The call cuts the next slice branch, named <id>—<n> where n is one more than the highest slice number the change’s pull requests and its workspace already hold (so two calls give two different slices), and gives it its own git worktree in the change’s workspace. If the change has no live workspace one is opened. Everything after that is automatic: the branch name, the worktree, removing the worktree once its pull request merges, and restacking a slice cut from another onto the default branch when that slice merges. A restack that conflicts is aborted and reported with the conflicting files; resolve those by hand on the slice branch, nothing is resolved for you. Without from the slice is cut from the default branch; with from set to another branch of the same change it is cut from that slice (the right choice when it builds on it). An abandoned change is refused with INVALID_ARGUMENT. The change id is the branch name <type>/<slug>; give it as it comes back — the SDK and the CLI encode the slash themselves. The workspace may still be starting when the call returns: directory is the path the worktree will have once it is available, and exists at once when the workspace is already running. From a terminal: praxis devops changes slice <change>.
签名
praxis.devops.changes.slices.create(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string;/** e.g. "feat/run-page-v2" */ change:string};body?:{/** Another branch of the same change to cut the slice from, such as feat/run-page-v2--2; omit it to cut from the default branch. e.g. "feat/run-page-v2--2" */ from?:string}}):Promise<{/** The new slice's branch, <change id>--<n> with n at least 2; commit and push here, and open its pull request with `praxis devops change pr`. e.g. "feat/run-page-v2--2" */ branch:string;/** The directory to work in: the slice's git worktree inside the change's workspace. e.g. "/workspace/repo-slices/2" */ directory:string;/** The id of the change's workspace that holds the slice (wsu_…), usable with the units methods; this call opened it when the change had none live. e.g. "wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit:string}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| project | path | string | 是 | Identifies the project whose data you are reading, from the project list or create answer. |
| change | path | string | 是 | The change whose slice you are opening: its id, which is its branch name <type>/<slug> from a change list or create answer. Give it as it comes back — `feat/run-page-v2`; the SDK and the CLI encode the slash themselves. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 否 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | The new slice: its branch, the directory to work in and the workspace that holds it. Calling again opens a further slice; it does not return the previous one. |
| 400 | application/json | INVALID_ARGUMENT means the change is abandoned, or from names a branch that does not belong to this change; nothing was cut. Open a new change, or pick from the change’s own branches. |
| 401 | application/json | The API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying. |
| 403 | application/json | The credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible. |
| 404 | application/json | CHANGE_NOT_FOUND means no change with that id exists in this organization; list the project’s changes and use an id from that answer, with its slash percent-encoded. |
| 500 | application/json | INTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again. |