Leave temporary files from a failed patch in a temporary directory for debugging purposes

Review Request #101 — Created June 26, 2007 and submitted


Review Board SVN (deprecated)


This change puts all Review Board temporary patch files in a subdirectory of the host operating system's temporary directory, which will be prefixed with "reviewboard.".  Successful patches are deleted normally, but files (the original, patchfile, and .rej file) that are part of a failed patch will be left for debugging.

This still isn't the absolutely correct way to handle this error.  If someone will make the view enclose the error text in a preformatted block, I will gladly revise this to output patch's output alongside the rejected portions, but as it stands, newlines are not respected.

Example error output:
The patch to 'near-time.net/branches/bug/3737/app/models/page.rb' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.r632GW' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.r632GW/tmpt8UkeH Hunk #1 FAILED at 20. 1 out of 1 hunk FAILED -- saving rejects to file /tmp/reviewboard.r632GW/tmpt8UkeH-new.rej
Working on our production server.
  1. I like this.  I don't suppose you'd be willing to make the error output of the template a bit prettier while you're at it?  Right now it just sticks black-on-white text where it would normally show the diff.
  2. Trailing whitespace.