File: api-branch.md

package info (click to toggle)
fossil 1%3A2.21-1%2Bdeb12u1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 26,916 kB
  • sloc: ansic: 309,417; tcl: 12,660; javascript: 9,603; sh: 6,071; makefile: 4,249; pascal: 1,139; cpp: 1,001; cs: 879; sql: 376; asm: 281; perl: 270; xml: 95
file content (86 lines) | stat: -rw-r--r-- 1,887 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# JSON API: /branch
([⬑JSON API Index](index.md))

Jump to:

* [Branch List](#list)
* [Create Branch](#create)

---

<a id="list"></a>
# Branch List

**Status:** implemented, at least in draft form, on 20110921.

**Required privileges:** "o"

**Request:** `/json/branch/list`

**Response payload example:**

```json
{
"range":"closed",
"current":"json", /* only when there is a local opened checkout */
"branches":[
  "artifact_description",
  "bch",
  "ben-changes-report",
  "ben-safe-make",
  "ben-security",
  "ben-testing",
]
}
```

*Potential* TODO: add "tip" property which names the most recently
modified branch? (How to get this?)

HTTP GET/`POST.payload` options:

-   `range`: a string in the set ("open", "closed", "all"),
    case-sensitive, but only the first letter is actually evaluated.
    Default="open". Only branches with this state are returned.

CLI mode options (same semantics as HTTP equivalents), must come last on
the CLI:

-   `-r|--range all|closed|open`
-   `-a` (equivalent to `-r all`)
-   `-c` (equivalent to `-r closed`). Only one of `-a`/`-c` may be specified,
    and if both are specified then which one takes precedence is
    unspecified.


<a id="create"></a>
# Create Branch

**Status:** implemented 20111002

**Required privileges:** "w"

**Request:** `/json/branch/create`

**Request options:**

-   `name=string` (REQUIRED) Name of new branch
-   `basis=string` (default=trunk) Name of parent branch to branch from.
-   `bgColor=string` (default=something ugly) In `#RRGGBB` form. (FIXME:
    change the default to use fossil's random bgcolor technique.)
-   `private=bool` (default=false) Determines whether the branch is
    private or not.

**Response payload example:**

```json
{
"name":"my-branch",
"basis":"my-other-branch",
"uuid":"de8115db4ce388ed8d0af666ae7d90e1410be4ca",
"isPrivate":true,
"bgColor":"#ff0000"
}
```