Fix interdiff post-processing with replace chunks overflowing ranges.

When post-processing interdiffs in order to filter out unrelated code,
we had issues where replace chunks could be generated where its
orig/modified ranges weren't equal. This would trigger an assert, which
is probably good, because removing the assert resulted in a
corrupted-looking diff.

This same sort of bug could also affect equal chunks in theory, though
in practice, they weren't in as bad a situation.

The reason this was failing was that we attempted to cap each range to
the chunk's boundaries, without any regard to whether or not the lengths
needed to be consistent.

Now, for equal and replace chunks, we get the lengths of the
orig/modified ranges for the chunk, figure out the longest of the two,
cap that within the valid range boundary, and use that as the end
positions for the chunk.

This ensures that we only show the replace/equal range for the section
represented in the union of the two diffs. Anything else outside of that
will turn into a filtered-equal.

I added a new unit test that previously broke but is fixed with this
change. However, I then noticed that another unit test broke. Turns out,
it was already broken. It had resulting replace/equal chunks that didn't
have consistent ranges, and chunks overflowing the bounds. After looking
at the original chunks and throwing away the unit test's bad resulting
chunks, I created a new set based on what they should have been. This
ended up matching the results of the unit test.

I added some new sanity-checking in the unit tests to make sure that any
opcode lists we provide in the future will meet certain criteria, to
help catch such issues in the future.

Fixes bug #3440
Reviewed at https://reviews.reviewboard.org/r/6030/
Improve error handling when validating CVS repositories.

Any CVS repository validation error would appear to the user as a
"repository not found," even if the repository was found but the
authentication credentials were bad. This was less than helpful.

We now log the full error returned by 'cvs version', and we look in it
for an authentication-related error. That is then raised as an
AuthenticationError, with the details of the error shown to the user.
That can help a lot with tracking down the real problem.

Reviewed at https://reviews.reviewboard.org/r/6059/
Clean up PyFlakes warnings and improve filtering.

This cleans up some pyflakes warnings that were found. There were only a
couple minor ones found in unit tests, and one entry that needed to be
added to the exclusion file.

This also fixes up run-pyflakes.py to exclude more files/paths by
default, and to support excluding subdirectories listed in
module_exclusions (in particular, reviewboard/htdocs/, which is handy if
you upload a Python file to a review request that has pyflakes errors).

Reviewed at https://reviews.reviewboard.org/r/6063/
Fix up paths in the NEWS file.

The NEWS file was pointing to the wrong directory for the Review Board
release notes and the wrong URL as well. These have been updated to
point to the modern locations.
Intelligently handle :pserver: paths for CVS repositories.

Our CVS repository path handling was pretty bad. We only injecting the
form's username and password if not specifying a repository type (such
as :pserver:). This led to a lot of confusion.

Now, our regex and CVSROOT building are a lot smarter. The user can
provide a :pserver: (or equivalent) CVSROOT, and either include or leave
out the username or password. Those will then be provided based on the
form input.

The workaround for using hostname:port/path format has been removed from
the docs, since it's far more natural to use a valid CVSROOT.

Reviewed at https://reviews.reviewboard.org/r/6060/
Clean up function name and docstring issues throughout the codebase.

This updates almost all the camelCase function names found in codebase
to use our standard naming convention. In some places, it also updates
docstrings to be more useful and clear. This will help contributors to
see good (or at least better) examples of how their tests and functions
should look.

This does not update any assert* function names, nor does it update
anything in the webapi codebase (since this is handled by another
change).

Reviewed at https://reviews.reviewboard.org/r/6062/
Clean up some function names in the webapi tests.

This brings some consistency to the naming of some utility methods in
the webapi tests. The apiGet, apiPost, etc. methods have been renamed to
api_get, api_post, etc. This adds consistency and helps prevent new
contributors from seeing those and using the wrong casing.
Use more specific assertions for 'in' checks.

A lot of old code used `assertTrue(blah in blah)`, or variants on that,
which didn't tell you much if there was a failure. Nowadays, we have
assertIn and assertNotIn, which we can use instead. This switches our
tests to use these.

Reviewed at https://reviews.reviewboard.org/r/6064/
Fix some unicode diff parsing bugs in the git backend.

This fixes some trivial bytes-vs-str issues that hadn't been caught by prior
testing.

Testing done: Ran unit tests.

Fixes bug 3467.

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