| | @@ -0,0 +1,86 @@ |
| 1 | +# JSON API: /branch
|
| 2 | +([⬑JSON API Index](index.md))
|
| 3 | +
|
| 4 | +Jump to:
|
| 5 | +
|
| 6 | +* [Branch List](#list)
|
| 7 | +* [Create Branch](#create)
|
| 8 | +
|
| 9 | +---
|
| 10 | +
|
| 11 | +<a id="list"></a>
|
| 12 | +# Branch List
|
| 13 | +
|
| 14 | +**Status:** implemented, at least in draft form, on 20110921.
|
| 15 | +
|
| 16 | +**Required privileges:** "o"
|
| 17 | +
|
| 18 | +**Request:** `/json/branch/list`
|
| 19 | +
|
| 20 | +**Response payload example:**
|
| 21 | +
|
| 22 | +```json
|
| 23 | +{
|
| 24 | +"range":"closed",
|
| 25 | +"current":"json", /* only when there is a local opened checkout */
|
| 26 | +"branches":[
|
| 27 | + "artifact_description",
|
| 28 | + "bch",
|
| 29 | + "ben-changes-report",
|
| 30 | + "ben-safe-make",
|
| 31 | + "ben-security",
|
| 32 | + "ben-testing",
|
| 33 | + …
|
| 34 | +]
|
| 35 | +}
|
| 36 | +```
|
| 37 | +
|
| 38 | +*Potential* TODO: add "tip" property which names the most recently
|
| 39 | +modified branch? (How to get this?)
|
| 40 | +
|
| 41 | +HTTP GET/`POST.payload` options:
|
| 42 | +
|
| 43 | +- `range`: a string in the set ("open", "closed", "all"),
|
| 44 | + case-sensitive, but only the first letter is actually evaluated.
|
| 45 | + Default="open". Only branches with this state are returned.
|
| 46 | +
|
| 47 | +CLI mode options (same semantics as HTTP equivalents), must come last on
|
| 48 | +the CLI:
|
| 49 | +
|
| 50 | +- `-r|--range all|closed|open`
|
| 51 | +- `-a` (equivalent to `-r all`)
|
| 52 | +- `-c` (equivalent to `-r closed`). Only one of `-a`/`-c` may be specified,
|
| 53 | + and if both are specified then which one takes precedence is
|
| 54 | + unspecified.
|
| 55 | +
|
| 56 | +
|
| 57 | +<a id="create"></a>
|
| 58 | +# Create Branch
|
| 59 | +
|
| 60 | +**Status:** implemented 20111002
|
| 61 | +
|
| 62 | +**Required privileges:** "w"
|
| 63 | +
|
| 64 | +**Request:** `/json/branch/create`
|
| 65 | +
|
| 66 | +**Request options:**
|
| 67 | +
|
| 68 | +- `name=string` (REQUIRED) Name of new branch
|
| 69 | +- `basis=string` (default=trunk) Name of parent branch to branch from.
|
| 70 | +- `bgColor=string` (default=something ugly) In `#RRGGBB` form. (FIXME:
|
| 71 | + change the default to use fossil's random bgcolor technique.)
|
| 72 | +- `private=bool` (default=false) Determines whether the branch is
|
| 73 | + private or not.
|
| 74 | +
|
| 75 | +**Response payload example:**
|
| 76 | +
|
| 77 | +```json
|
| 78 | +{
|
| 79 | +"name":"my-branch",
|
| 80 | +"basis":"my-other-branch",
|
| 81 | +"uuid":"de8115db4ce388ed8d0af666ae7d90e1410be4ca",
|
| 82 | +"isPrivate":true,
|
| 83 | +"bgColor":"#ff0000"
|
| 84 | +}
|
| 85 | +```
|
| 86 | +
|