Add support for downloading patches and parsed diff data in the API.
Review Request #1642 — Created June 7, 2010 and submitted
Add support for downloading patches and parsed diff data in the API. This adds support for new mimetypes to FileDiffResource and DiffSetResource. Both now support the text/x-patch mimetype, and will return the stored patch. In the case of FileDiffResource, it's the patch for that particular file, and for DiffSetResource, it's the patch for all files in the diff. FileDiffResource also supports new application/vnd.reviewboard.org.diff.data+json and application/vnd.reviewboard.org.diff.data+xml mimetypes, which return the parsed diff data in JSON or XML formats. This includes the insert/delete/replace lines, move information, and more. It also supports a ?syntax-highlighting=1 parameter for returning data in a form that can have CSS rules applied for syntax highlighting. This new diff data resource should make it possible for third party applications to render diffs without reimplementing Review Board's diff viewer logic.
Tested each resource using curl in order to see the various forms of output.
Christian: Looks OK to me - GETing from http://localhost:8080/api/review-requests/2/diffs/1/ with text/x-patch as the Accept in the header correctly gets me the patch. However, GETing from http://localhost:8080/api/review-requests/2/diffs/1/files/2/ with text/x-patch as the Accept in header gives me a big JSON string (see: http://www.pastie.org/1002052)...which is strange, because I *think* I'm suppose to get the patch for a particular file. Could be I'm not using curl correctly. Anyhow, just a heads up. -Mike