The documentation for /json/wiki/diff/v1/v2 says that v1 and v2 are the UUIDs of wiki page versions, and that the diff is from v1 to v2.

In my test case, I use /json/wiki/create and /json/wiki/save to create and update a page named "Page2". I then inspect the change I made with /json/wiki/diff/uuid1/uuid2 the UUIDs match the parent and uuid fields returned from /json/wiki/get/Page2. That should show the addition of a single line to the content. What I get back in the content field of the payload is:

@@ -1,2 +1,1 @@
 Lorem ipsum dolor sic amet.
-consectetur adipisicing elit.

Which would seem to read as the deletion of a line, not the insertion of a line. In other words, it appears that the diff is reversed.

C:...\ftest\json>..\fossil json wiki get Page2
{
        "fossil":"c4f8d88fd91a8925f832e1b58228cdf7f8aff3c1",
        "timestamp":1453941765,
        "command":"wiki/get",
        "procTimeUs":0,
        "procTimeMs":0,
        "payload":{
                "name":"Page2",
                "uuid":"1fc892ee8c1fd776e7b2baf7ba4f7b5898a2a95a",
                "parent":"ecf8623c657bc260ca927f374aaf1b627f96b7a4",
                "user":"Ross",
                "timestamp":1453941668,
                "size":57,
"content":"Lorem ipsum dolor sic amet.\nconsectetur adipisicing elit.",
                "contentFormat":"raw"
        }
}
C:...\ftest\json>..\fossil json wiki diff ecf862 1fc892
{
        "fossil":"c4f8d88fd91a8925f832e1b58228cdf7f8aff3c1",
        "timestamp":1453941731,
        "command":"wiki/diff",
        "procTimeUs":0,
        "procTimeMs":0,
        "payload":{
                "v1":"ecf8623c657bc260ca927f374aaf1b627f96b7a4",
                "v2":"1fc892ee8c1fd776e7b2baf7ba4f7b5898a2a95a",
"diff":"@@ -1,2 +1,1 @@\n Lorem ipsum dolor sic amet.\n-consectetur adipisicing elit.\n"
        }
}

Reversing the UUID parameters gives:

C:...\ftest\json>..\fossil json wiki diff 1fc892 ecf862
{
        "fossil":"c4f8d88fd91a8925f832e1b58228cdf7f8aff3c1",
        "timestamp":1453942631,
        "command":"wiki/diff",
        "procTimeUs":0,
        "procTimeMs":0,
        "payload":{
                "v1":"1fc892ee8c1fd776e7b2baf7ba4f7b5898a2a95a",
                "v2":"ecf8623c657bc260ca927f374aaf1b627f96b7a4",
"diff":"@@ -1,1 +1,2 @@\n Lorem ipsum dolor sic amet.\n+consectetur adipisicing elit.\n"
        }
}

And that better agrees both with my expectation and with what the GUI says for /wdiff?name=Page2&a=6:

     1      1   Lorem ipsum dolor sic amet.
            2  +consectetur adipisicing elit.

The json tests current as of checkin [cb611ffc9b] show this issue.

--
Ross Berteig                               r...@cheshireeng.com
Cheshire Engineering Corp.           http://www.CheshireEng.com/
+1 626 303 1602
_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev

Reply via email to