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