|
1
|
# JSON API: /diff |
|
2
|
([⬑JSON API Index](index.md)) |
|
3
|
|
|
4
|
# Diffs |
|
5
|
|
|
6
|
**Status:** implemented 20111007 |
|
7
|
|
|
8
|
**Required permissions:** "o" |
|
9
|
|
|
10
|
**Request:** `/json/diff[/version1[/version2]]` |
|
11
|
|
|
12
|
**Request options:** |
|
13
|
|
|
14
|
- `v1=string` Is the "from" version. It may optionally be the first |
|
15
|
positional parameter/path element after the command name. |
|
16
|
- `v2=string` Is the "to" version. It may optionally be the first |
|
17
|
positional parameter/path element after the v1 part. |
|
18
|
- `context=integer` (default=unspecified) Defines the number of context |
|
19
|
lines to display in the diff.\ |
|
20
|
CLI: `--context|-c` |
|
21
|
- `sbs=bool` (default=false) Generates "side-by-side" diffs, but their |
|
22
|
utility in JSON mode is questionable. |
|
23
|
- `html=bool` (default=false) causes the output to be marked up with |
|
24
|
HTML in the same manner as it is in the HTML interface. |
|
25
|
|
|
26
|
**Response payload example:** |
|
27
|
|
|
28
|
```json |
|
29
|
{ |
|
30
|
"from":"7a83a5cbd0424cefa2cdc001de60153aede530f5", |
|
31
|
"to":"96920e7c04746c55ceed6e24fc82879886cb8197", |
|
32
|
"diff":"@@ -1,7 +1,7 @@\\n-C factored\\\\sout..." |
|
33
|
} |
|
34
|
``` |
|
35
|
|
|
36
|
TODOs: |
|
37
|
|
|
38
|
- Unlike the standard diff command, which apparently requires a commit |
|
39
|
hash, this one diffs individual file versions. If a commit hash is |
|
40
|
provided, a diff of the manifests is returned. (That should be |
|
41
|
considered a bug - we should return a combined diff in that case.) |
|
42
|
- If hashes from two different types of artifacts are given, results |
|
43
|
are unspecified. Garbage in, garbage out, and all that. |
|
44
|
- For file diffs, add the file name(s) to the response payload. |
|
45
|
|