Send email when closing review requests

Optionally send emails when closing review requests. Add a flag in the Email
settings page that will allow for sending emails when a review request is closed
(Submitted/Discarded).

Files Changed:
reviewboard/admin/forms.py
+ Added Boolean to store the value of "mail_send_review_close_mail" in settings

reviewboard/notifications/email.py
+ Added callback method for review_request_closed signal

reviewboard/templates/notifications/review_request_email.html
reviewboard/templates/notifications/review_request_email.txt
+ Added code to display the "Status" of the review request when it's closed
  before the "Description" section.

Tests:
+ Added test for review request closing
+ Modified other review related tests to fix counts or expected results

Testing done: Added test for this feature and ran all tests. Verified in UI.

Fixes bug 422
Reviewed at http://reviews.reviewboard.org/r/3707/
Add a capability to indicate support for Perforce moved files.

1.7.2 introduced moved file support for Perforce, but there wasn't a
good way for RBTools to really detect this that retained compatibility
with previous versions of Review Board. The reason is that we relied
upon the existing general diffs.moved_files capability, causing RBTools
to generate diffs for older releases that ended up being incompatible.

This introduces a scmtools.perforce.moved_files cap that can be used
instead. 1.7.3 will be the minimum version of Review Board that will
support moved files for Perforce with RBTools.
Add a new BaseResource model that will be used by all API models.

The BaseResource model provides all the common functionality for dealing
with requests and parsing results, ensuring a model is ready to use (has
its data fetched) before we do anything with it, and being able to
ensure it's created before using it. These models have a concept of a
parent resource that they're under (for example, a diff being under a
review draft).

This change just introduces this model and a suite of unit tests for it.
We'll move over to this in subsequent commits.
Merge branch 'release-1.7.x'
Bump to 1.7.3 dev.
Let #summary_wrapper expand its height when summary line-wraps.

Remove height attribute for #summary_wrapper, so it will expand its
height when summary line-wraps.

Reviewed at http://reviews.reviewboard.org/r/3784/
Fix setting time_added when publishing a review request.

The change added to set time_added to the publish time caused the
creation time to always be the publish time for every publish, not just
the first.

We now only set this when there hasn't been any changes previously made
to the review request and it's being published the first time.
Fix a crash when the right-side diff doesn't have a header.

There was an error when parsing a diff where there were headers on the
left-hand side but not the right-hand side. The solution was found by
Ze Lin Xiao at NetApp.

Fixes bug #2876
Fix unescaping comment text in the diff viewer when the text is blank.

If the comment text was blank, we'd hit a failure when unescaping the
text. I believe this may have been a change in jquery when passing in an
empty string to html().

Now we only do the unescaping logic if the comment text is blank.

Ideally, this would use _.unescape, but we don't have a new enough
underscore.js yet.
Stop showing a console window when using cleartool on Windows 7.

When running on Windows 7 and using cleartool, a consoel window would
show up for every invocation. Switching the Popen calls to pass
shell=True prevents his from happening.

Reviewed at http://reviews.reviewboard.org/r/3804/
Rework the Mercurial version checking to not break.

The Mercurial version checking was breaking in weird ways. This change
attempts to do a better job at checking the version.

First, we use their own version() function, if available.

If we can't import that, we'll try getting __version__ again, but in a
different way. We'll import the module and not the constant within it.

If that doesn't work, or if we get a version of None, we set it to an
empty string, which will result in the 'if <= 1.2' check passing.
Release Review Board 1.7.3.
Merge branch 'release-1.7.x'
Add release notes for RBTools 0.4.3.
Fix a regression with displaying diff viewer file entries.

The "Files Changed" list in the diff viewer broke with Windows-style
paths. A previous change was made to fix a JavaScript injection issue,
but that caused some escaping issues when using backslashes. We now
escape both HTML and JavaScript.
Fix the console fallbacks to not break older browsers.

The console fallbacks were designed to work if no console API was
defined, but it still ended up accessing stuff inside of console. It
also had some unused code at the end. This has been fixed and should
restore compatibility with Firefox 3.x and IE.

Fixes bug #2880
Release Review Board 1.7.4.
Merge branch 'release-1.7.x'
Added nice styling of diffs in the FileDiff admin UI.

The FileDiff admin UI previously just showed diffs with no whitespace
preservation, which was useless. We now style it with Pygments, which is
nicer to look at.
Add automatic migration from FileDiff to FileDiffData on access.

In 1.7, we added the FileDiffData model, which stores the data of a diff
(be it a standard diff or a parent diff) in one place, hashed, in order
to reduce file size. This was only applied to newer diffs, and older
ones still had their data retrieved from the FileDiff.diff64 or
FileDiff.parent_diff64 fields.

This change adds automatic migration to FileDiffData when accessing
either FileDiff.diff or FileDiff.parent_diff. When accessed, we check if
there's an appropriate hash for the given field, and if not, we create a
FileDiffData for both and move the data over.

This ensures that we only ever read data from one spot now. As older
review requests are accessed, the database may shrink in size (in
general, assuming there are some redundant bits of diff data).

Ensuring that there's always a FileDiffData when dealing with diff data
simplifies some of our assumptions and will allow some new pieces of common
information we'll add to exist in only one place as well.

Unit tests were added to ensure that the migration paths work as
expected, and clean up after the old data.