Fossil SCM

doc additions for /json/diff.

stephan 2011-10-08 05:16 json-multitag-test
Commit a37df1d939fc1555b170bdc1afec31cf80b986c2
1 file changed +12 -2
+12 -2
--- src/json_diff.c
+++ src/json_diff.c
@@ -23,11 +23,13 @@
2323
#endif
2424
2525
2626
2727
/*
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.
2931
*/
3032
cson_value * json_generate_diff(const char *zFrom, const char *zTo,
3133
int nContext){
3234
int fromid;
3335
int toid;
@@ -42,11 +44,11 @@
4244
return NULL;
4345
}
4446
toid = name_to_typed_rid(zTo, "*");
4547
if(toid<=0){
4648
json_set_err(FSL_JSON_E_UNRESOLVED_UUID,
47
- "Could not resolve 'from' ID.");
49
+ "Could not resolve 'to' ID.");
4850
return NULL;
4951
}
5052
content_get(fromid, &from);
5153
content_get(toid, &to);
5254
blob_zero(&out);
@@ -62,10 +64,18 @@
6264
}
6365
6466
/*
6567
** Implementation of the /json/diff page.
6668
**
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
+**
6777
*/
6878
cson_value * json_page_diff(){
6979
cson_object * pay = NULL;
7080
cson_value * v = NULL;
7181
char const * zFrom;
7282
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button