Raise an error when uploading a non-git diff to a git repository.

When uploading a non-git diff (whether an image file or anything else),
GitDiffParser would assume it's just an empty file. We now sanity check
this better by seeing if we parsed any files, and if not, if we're
dealing with a non-empty file. If no files were parsed and the file is
not just empty or whitespace, we assume it's some unknown file type.
Fix a couple regressions in the diff viewer.

This fixes two regressions, one new, and one that's been around since
the rewrite.

The new one blocks viewing unpublished diffs. The template code setting
up the diff-related models was assuming the existence of the
latest_diffset object, which didn't exist in this case. The result was
that no value was outputted, leading to invalid JavaScript, which
prevented any diffs from loading.

The second was a visual glitch that resulted in an extra ">" before the
expand links for headers. This was due to the ">" being after the wrong
endif tag.
Make PySVN optional for unit tests.

The unit tests no longer depend on PySVN. Some of the remaining tests
using Subversion repositories have been updated to use Git instead, and
the rest now use a new TestTool that is based off Git but has many
testable properties for things like branches, commits, basedir, etc.

You can now remove PySVN from your system and run the test suite. The
real Subversion-specific tests will just skip, and all main tests will
run.
Add the missing scmtools.py.

This was left out of my testing improvement change.
Move the diff revision selector into javascript.

Rather than generating this from the django template and including links, it's
now generated on the client-side, and clicks are handled by triggering the
"revisionSelected" event. This still ends up navigating to another page, but
it's a step towards avoiding the reload.

Testing done:
* Navigated to different diff and interdiff revisions.
* Ran js-tests.
* Ran jshint.

Reviewed at https://reviews.reviewboard.org/r/4565/
Clean up the view_diff.html template.

This change removes some obsolete variable definitions, fixes indentation on
template tags, and generally cleans things up.

Testing done:
Played around with the diff viewer a bit and checked that things looked right.

Reviewed at https://reviews.reviewboard.org/r/4568/
Provide WebAPIResource in reviewboard.webapi.resources again.

The recent API codebase restructuring moved WebAPIResource into
reviewboard.webapi.base, but older extensions expected this to be found
in reviewboard.webapi.resources. That's completely valid, so now we
provide it there as well.

Older extensions importing the various resource instances will still
need to be updated, though.
Fix unit test failures when the host has no internet connection.

One annoying aspect of working on planes is that several of the unit tests fail
in ugly ways if the host has no internet access. I've added a check that tries
to resolve the hostname for google.com and skips any tests that require network
access.

Eventually, we should fix these tests to use mocks running on the host to
completely isolate us from third-party servers and internet connections.

Testing done: Ran unit tests whilst in-flight.
Reviewed at https://reviews.reviewboard.org/r/4569/
Turn off autocomplete for username/password fields in E-Mail Settings

When the username and password fields are set to blank and saved,
the fields are automatically filled by Chrome with the previous values,
indicating that the blank values are not saved successfully even though they
are. Turning off autocomplete for these fields avoids such confusion.

Testing done:
Manually tested updating username/password with both empty and
non-empty values.

Unit tests pass.

Fixes bug 2380.
Reviewed at https://reviews.reviewboard.org/r/4579/
Merge branch 'release-1.7.x'
Reduce docstring line lengths for webapi unit tests.

An annoying thing about submitting webapi unit test code for review is
that ReviewBot would be very sad about the docstring line lengths. These
were long because unit tests, by default, only show the first line.
However, that's under our control, it turns out.

Now, the new base TestCase will grab the summary, even if it's wrapped
across lines, and turn it into one line.

All the docstrings have been updated in the webapi tests for this. The
rules I used for formatting them is as follows:

1) If it can fit on one line, then keep it on one line.
2) If it needs to wrap, wrap the details part after "API" (such as
   "with ...") on the next line.
3) If it still needs to wrap, wrap the "METHOD URL API" part onto its
   own line, keeping it together as much as possible.
4) If it still needs to wrap, break that part up as needed.

Some URLs are long enough by themselves where they will still trigger
warnings, but this is limited to only a few instances now.
Clean up the order of webapi tests.

This is the next part of my master plan to improve the webapi test
suite. Tests are now divided into List and Item tests, and within these,
the tests are ordered alphabetically by HTTP method.

The next part will be to group list and item tests under their own test
suites and to simplify the function names.

There were no logic changes made to tests. They've only moved around.
However, some functions were renamed to use "put" or "post" instead of
"update" or "create".
Get rid of deprecated TestCase assertion methods.

TestCase has a bunch of methods which have been replaced with other names for
various reasons. We've fixed up most but not all of these. This change converts
all of these to use the new names.

Testing done: Ran unit tests

Reviewed at https://reviews.reviewboard.org/r/4581/
Make sure to always fix up the MEDIA_ROOT after admin tests.

If UpdateTests.testManualUpdatesRequiredBadUpload fails (say, due to something
being rendering the base.html template), it will leave settings.MEDIA_ROOT and
siteconfig's site_media_root in a broken state. This breaks a bunch of other
tests, which is highly confusing.

Testing done:
Ran into this case when working on my django1.5 branch, and this fixed it.

Reviewed at https://reviews.reviewboard.org/r/4584/
Switch function-based generic views to class-based ones.

The old object_list and redirect_to views are gone, in favor of ListView and
RedirectView. This change switches us over to them.

Testing done:
* Verified that views still worked.
* Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/4582/
Don't blindly call next_page_number() or previous_page_number().

The pagination methods have been changed to raise EmptyPageError if there's no
such page. We therefore can't blindly add things to the context, but rather
should check that the pages exist before we call these methods.

Testing done:
* Loaded a diff that spanned multiple pages.
* Ran unit tests

Reviewed at https://reviews.reviewboard.org/r/4588/
Fix up our manage.py for Django 1.3 deprecations.

The setup_environ() and execute_manager() methods were deprecated, in favor of
the new execute_from_command_line() and setting the DJANGO_SETTINGS_MODULE
variable. These were deprecated in Django 1.3 and removed in 1.5. We inherited
these by virtue of the fact that we modified the old manage.py--this updates
our code to look more like the new manage.py.

Testing done:
* Ran unit tests
* Used the devserver a bit

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