Add infinite scroll for commits in the new review request UI.

This change makes it so scrolling to within 50px of the bottom of the list of
commits in the New Review Request page will automatically load another page.
This shows the little "Loading..." spinner at the top, but is otherwise pretty
seamless.

Testing done:
- Loaded many pages of commits.
- Connected a repo with only a small number of commits, and saw that it stopped
  loading once I hit the bottom.

Reviewed at https://reviews.reviewboard.org/r/4411/
Fix default value for HostingService._http_request headers parameter

The default value for the 'headers' parameter to the _http_request was None,
which meant that if something called it without passing in headers,
urllib2.Request()'s constructor would throw an exception. Other similar code
uses a default value of an empty dictionary, which is more appropriate.

Reviewed at https://reviews.reviewboard.org/r/4392/
Allow HostingServices to validate repositories.

A HostingService may know best whether a given repository configuration
is valid. In the case of HTTPS-backed repositories, it's actually
preferable that the HostingService does the check, since the Repository
entry may not have an associated username/password stored.

Now, when validating repositories, we go through the HostingService, if
one is selected. That will fall back to the SCMTool's validation, unless
a subclass overrides validate_repository and provides this
functionality.

The webapi implementation of repository validation does not make use of
this, since at that level, there's no information on the hosting service
data. When repository configuration is rewritten, that may change. For
now, it's assumed that anyone going through the API is just setting up
standard repositories in-house.

Beanstalk will be making use of this in an upcoming change.
Pass on base_commit_id to hosting services for file lookups.

The base_commit_id is now passed on to the get_file/get_file_exists
functions in hosting services, so that they may make use of it when
fetching file data.

It's not passed on to SCMTools, since we currently have no need there,
but it can be added later if needed.

This, combined with some upcoming changes, will allow us to support
services like Beanstalk and BitBucket for Git.
Use escapejs on URL and captions for file attachments.

Most URLs are fine, but in the case where we're using authenticated URLs with
S3, we'll have &amp; in the URL where we wanted &.
Add support for Beanstalk as a hosting service.

This supports both Git and Subversion repositories on Beanstalk. It
makes use of the new base_commit_id support and hosting service
repository validation.

Unit tests were added for all the new functionality.
Merge branch 'release-1.7.x'
Fix "From" field in emails for --submit-as

When sending emails for review requests, reviews, and replies, we'd send it
from the request user, rather than the owner of the relevant object. This made
using --submit-as pretty ugly.

At some point in the future, we want to enable many users to collaborate on the
same review request, at which point we'll have to revisit this, but for now,
fix the bugs.

Testing done: Ran unit tests

Fixes bugs 1795 and 2500.
Reviewed at https://reviews.reviewboard.org/r/4418/
Add support for BitBucket's APIs, and support for Git.

We now use BitBucket's APIs for repository validation and for file
fetching. This, combined with usage of the new base_commit_id field,
allows us to finally add support for Git on BitBucket.

Unit tests were added to test all this functionality.
Redo the "New Review Request" UI.

This is a mostly complete rewrite of our "New Review Request" page to support
both pre- and post-commit reviews.

For repositories which support it (currently SVN and GitHub), it shows two
sections: "New Review Request for Pending Change" and "New Review Request for
Committed Change".

The pending change workflow is similar to what we had before in its
functionality, but it's a bit more streamlined (in the simplest case, it's just
"click on the repository name and then drop a diff file in the box"). It also
tries a little bit harder to validate that the diffs that people create are
valid before actually putting anything in the database, and shows some better
error messages (especially in the case of git without --full-index).

The one feature that the old forms had was parent diff support. I've decided
that for now, it will just point people to using rbtools.

The post-commit workflow is super easy--select a branch, and select a commit.

Testing done:
- Created a ton of review requests against various different repositories.
  Verified that I can do post-commit requests for GitHub and SVN, and that I
  can do pre-commit requests for any repo.
- Checked that the "None" repo allows me to create an empty review request.
- Ran js-tests and python unit tests
- Ran jshint

Fixes bug 100.
Reviewed at https://reviews.reviewboard.org/r/4215/
Markdown Review UI

This adds functionality to render Markdown file attachments in Review Board.

The rendering is handled by the "markdown" Python package which, given a file,
returns the HTML code for it. This HTML code is then passed to the Backbone
view for the Markdown Pluggable UI through the template and rendered in the
browser.

This is based on the change at https://reviews.reviewboard.org/r/3434/
The major changes are:
- Port to the new 1.8.x JS model/view parameters and remove the extra template
  file.
- Use safe_mode='escape' when rendering to disallow users from using arbitrary
  HTML tags.
- Add comment thumbnails, so we get excerpts in the reviews page. I can't
  decide if using minidom to parse the outputted HTML and extract a specific
  node is awesome or awful, but it seems to work very reliably and keeps us
  secure.
- Cache the rendering of the markdown file, which comes in handy for those
  comment thumbnails.

Testing done:
"Valid" Case:
1) Created a review request and uploaded multiple random files to it
2) Then, uploaded a valid Markdown file (with the extension .md) to that review
   request
3) Clicked the "Review" link for the Markdown file
4) The new page loaded should render the Markdown file

"Invalid" Case:
1) Created a review request and uploaded multiple random files to it
2) Then, uploaded an image to that review request by changed the file extension
   to be ".md". For example, wallpaper.png -> wallpaper.md
3) Clicked the "Review" link for the invalid Markdown file
4) The new page loaded did not render anything (i.e. it displayed the title and
   caption but nothing was displayed in the section where the HTML would have
   rendered)

Reviewed at https://reviews.reviewboard.org/r/4414/
Set a sane default for hosting_service when validating repos.

We were accessing hosting_service without ensuring it always had a
value. We now default to None.
Merge branch 'release-1.7.x'
Don't use unique_together in HostingServiceAccount.

The unique_together constraint broke several MySQL instances, due to the
combined key name length being too long when using UTF-8.

This particular index isn't that useful to us in practice, so nuke it
until we know more about why this fails.

Any existing tables that have this successfully added should continue to
be fine. Any new ones won't have it. Django-Evolution doesn't get
involved with unique_together, so there's no evolution to ship.
Improve i18n a bit.

I'm working on integrating the Italian localization that we recieved at
https://reviews.reviewboard.org/r/4298/

There are a few things that were getting in the way here. We have some old i18n
scripts in contrib/ which mostly work, but should be removed in favor of the
django-admin.py versions. The django-admin.py version of makemessages was
erroring out in a couple places where we were using positional format strings
with multiple arguments, instead of parameter names. I've fixed these up.

There are also several strings which aren't marked for translation. A lot of
these are likely coming from javascript, but one that was immediately obvious
was the dashboard's sidebar.

Testing done:
Integrated the contributed Italian localization files, and ran
compilemessages. Set my browser to prefer Italian, and saw that most of
the UI was now translated. Neat.

Reviewed at https://reviews.reviewboard.org/r/4426/
Make use of Beanstalk's new blob API for fetching files.

Beanstalk kindly added a blob API for us so that we could easily fetch
the contents of files without need the base_commit_id. That gives our
users the choice to continue using older versions of RBTools or to
upload a standard 'git diff' if they choose.

We now use the new blob API when fetching the raw contents of a file, or
when we need to check file existence without having a base_commit_id.

Unit tests were updated to handle the new flows, and to not expect
errors in the case of Git + no base commit ID.
Merge branch 'release-1.7.x'
Add en, it_IT, and zh_TW locale files.

This change pulls in the Italian and Chinese localizations that have been
contributed. Some of the translated strings are out of date (and thus marked
"fuzzy"), and there are still a number of strings, mostly from JavaScript, that
aren't translatable, but this is a pretty good start.

Testing done:
Set my browser language preferences to prefer Italian and (Traditional) Chinese
over English. Reloaded, and saw my dashboard and review requests in other
languages.
Fix display_id usage in the trophy box.

The trophy box was using the review request's display_id to compute whether to
display, but was using id for the text displayed on the page.

Fixes bug 3037.
Fix jshint issues.

Simple fixes for simple issues.