Fossil SCM
doc additions for /json/diff.
Commit
a37df1d939fc1555b170bdc1afec31cf80b986c2
Parent
7906bab836801ed…
1 file changed
+12
-2
+12
-2
| --- src/json_diff.c | ||
| +++ src/json_diff.c | ||
| @@ -23,11 +23,13 @@ | ||
| 23 | 23 | #endif |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | /* |
| 28 | -** Append the difference between two RIDs to the output | |
| 28 | +** Generates a diff between two versions (zFrom and zTo), using nContext | |
| 29 | +** content lines in the output. On success, returns a new JSON String | |
| 30 | +** object. On error it sets g.json's error state and returns NULL. | |
| 29 | 31 | */ |
| 30 | 32 | cson_value * json_generate_diff(const char *zFrom, const char *zTo, |
| 31 | 33 | int nContext){ |
| 32 | 34 | int fromid; |
| 33 | 35 | int toid; |
| @@ -42,11 +44,11 @@ | ||
| 42 | 44 | return NULL; |
| 43 | 45 | } |
| 44 | 46 | toid = name_to_typed_rid(zTo, "*"); |
| 45 | 47 | if(toid<=0){ |
| 46 | 48 | json_set_err(FSL_JSON_E_UNRESOLVED_UUID, |
| 47 | - "Could not resolve 'from' ID."); | |
| 49 | + "Could not resolve 'to' ID."); | |
| 48 | 50 | return NULL; |
| 49 | 51 | } |
| 50 | 52 | content_get(fromid, &from); |
| 51 | 53 | content_get(toid, &to); |
| 52 | 54 | blob_zero(&out); |
| @@ -62,10 +64,18 @@ | ||
| 62 | 64 | } |
| 63 | 65 | |
| 64 | 66 | /* |
| 65 | 67 | ** Implementation of the /json/diff page. |
| 66 | 68 | ** |
| 69 | +** Arguments: | |
| 70 | +** | |
| 71 | +** v1=1st version to diff | |
| 72 | +** v2=2nd version to diff | |
| 73 | +** | |
| 74 | +** Can come from GET, POST.payload, CLI -v1/-v2 or as positional | |
| 75 | +** parameters following the command name (in HTTP and CLI modes). | |
| 76 | +** | |
| 67 | 77 | */ |
| 68 | 78 | cson_value * json_page_diff(){ |
| 69 | 79 | cson_object * pay = NULL; |
| 70 | 80 | cson_value * v = NULL; |
| 71 | 81 | char const * zFrom; |
| 72 | 82 |
| --- src/json_diff.c | |
| +++ src/json_diff.c | |
| @@ -23,11 +23,13 @@ | |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | |
| 27 | /* |
| 28 | ** Append the difference between two RIDs to the output |
| 29 | */ |
| 30 | cson_value * json_generate_diff(const char *zFrom, const char *zTo, |
| 31 | int nContext){ |
| 32 | int fromid; |
| 33 | int toid; |
| @@ -42,11 +44,11 @@ | |
| 42 | return NULL; |
| 43 | } |
| 44 | toid = name_to_typed_rid(zTo, "*"); |
| 45 | if(toid<=0){ |
| 46 | json_set_err(FSL_JSON_E_UNRESOLVED_UUID, |
| 47 | "Could not resolve 'from' ID."); |
| 48 | return NULL; |
| 49 | } |
| 50 | content_get(fromid, &from); |
| 51 | content_get(toid, &to); |
| 52 | blob_zero(&out); |
| @@ -62,10 +64,18 @@ | |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | ** Implementation of the /json/diff page. |
| 66 | ** |
| 67 | */ |
| 68 | cson_value * json_page_diff(){ |
| 69 | cson_object * pay = NULL; |
| 70 | cson_value * v = NULL; |
| 71 | char const * zFrom; |
| 72 |
| --- src/json_diff.c | |
| +++ src/json_diff.c | |
| @@ -23,11 +23,13 @@ | |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | |
| 27 | /* |
| 28 | ** Generates a diff between two versions (zFrom and zTo), using nContext |
| 29 | ** content lines in the output. On success, returns a new JSON String |
| 30 | ** object. On error it sets g.json's error state and returns NULL. |
| 31 | */ |
| 32 | cson_value * json_generate_diff(const char *zFrom, const char *zTo, |
| 33 | int nContext){ |
| 34 | int fromid; |
| 35 | int toid; |
| @@ -42,11 +44,11 @@ | |
| 44 | return NULL; |
| 45 | } |
| 46 | toid = name_to_typed_rid(zTo, "*"); |
| 47 | if(toid<=0){ |
| 48 | json_set_err(FSL_JSON_E_UNRESOLVED_UUID, |
| 49 | "Could not resolve 'to' ID."); |
| 50 | return NULL; |
| 51 | } |
| 52 | content_get(fromid, &from); |
| 53 | content_get(toid, &to); |
| 54 | blob_zero(&out); |
| @@ -62,10 +64,18 @@ | |
| 64 | } |
| 65 | |
| 66 | /* |
| 67 | ** Implementation of the /json/diff page. |
| 68 | ** |
| 69 | ** Arguments: |
| 70 | ** |
| 71 | ** v1=1st version to diff |
| 72 | ** v2=2nd version to diff |
| 73 | ** |
| 74 | ** Can come from GET, POST.payload, CLI -v1/-v2 or as positional |
| 75 | ** parameters following the command name (in HTTP and CLI modes). |
| 76 | ** |
| 77 | */ |
| 78 | cson_value * json_page_diff(){ |
| 79 | cson_object * pay = NULL; |
| 80 | cson_value * v = NULL; |
| 81 | char const * zFrom; |
| 82 |