Return an informative error message when a review is posted with a duplicate commit id.

The reproduction steps described in bug 3328 could not be reproduced. When
following the steps, I would receive a HTTP 500 error when making the second
post. This is a result of Django not being used previously to validate the
data. Instead it was being left to the database, which is checked and handled
differently depending on which database is used and it's configuration. To fix
this creation was changed to instantiation to prevent partial saving, a
validation step was added prior to saving, a new webapi error was added, and
the error code was documented in the manual.

Testing Done:
I tested to ensure when making the second rbt post that the error was caught
and an informative error message was displayed, rather than an HTTP 500 error.
I also checked after the failure to ensure that a partial review object was not
created. I also tested to ensure that posts could still be created if they had
a unique commit id.

Bugs closed: 3329

Reviewed at https://reviews.reviewboard.org/r/5815/
Add 'phtm' to the displayed list of extensions for the security checks.

The security checker for file attachment extensions was checking .phtm files,
but they weren't listed in the text.

Trivial fix.

Fixes part of bug 3368.
Better manage memory usage of condensediffs.

condensediffs had some memory issues. Even though we were using
QuerySet.iterator, it seems memory was still increasing far too much.

To work around this, we're using a couple tricks that we used in
loaddb and dumpdb. We're only operating on batches of 200 diffs at a
time, and are resetting queries and garbage-collecting after each batch.

The query resets shouldn't impact production installs, since DEBUG
should be False, but it's a precaution. We're also forcing DEBUG to be
False in the management command as well.

With these changes, memory still increases over time, to a degree, but
seems to stabilize. This is with a sample set of over 8200 diffs.

Reviewed at https://reviews.reviewboard.org/r/5870/
Improve the output of condensediffs.

condensediffs will now show a percentage of completion, making it easier
to see how much longer the operation will take. It also formats the
resulting byte counts with commas, for readability.

Reviewed at https://reviews.reviewboard.org/r/5871/