Conditionalize ez_setup

This makes life simpler for packagers, since most packaging tools
will ensure that the appropriate packages are available on the
system. Additionally, most packaging tools prefer not to rely on
network access (since it can mean that identical rebuilds cannot
be performed).

Built locally with 'python setup.py build' and also by applying this patch and
performing an RPM build in a network-free environment.

Reviewed at http://reviews.reviewboard.org/r/3186/
Split get_diff_files into get_diff_files and populate_diff_chunks.

get_diff_files was set up to run in two possible modes. In one mode, it
just fetched all the files and metadata that would be displayed in a
diff viewer. In the other mode, it would do that and load diff chunks.

Really, there was no reason to do both. It just made things more
complicated. The information loading mode was nothing but database hits,
so we had a certain known level of complexity there. The chunk loading
code, however, was very expensive, and drastically changed what you
would expect time-wise from the function.

Now the chunk loading is done in populate_diff_chunks, which just
iterates through the list of files provided by get_diff_files and loads
the chunks for each.

This is the first step in a series of changes I'm planning to make to
restructure bits of the diff handling code to make it more extensible.
Fix some stylistic issues introduced by the Diff Updated column change.

The Diff Updated column change had some indentation issues and old-style
parent class usage. This change fixes them up to meet the standards.
Fix issues with spurious update bubbles and incorrect HTTP status codes.

The update bubbles on 1.7 have been broken for a while. Changing issue
statuses would cause an update bubble to appear, due to the timestamp
coming in not being in the correct format. We now set it exactly as the
Last Update resource sets it, by returning
last_activity_time.isoformat().

The Last Update resource was broken too. Every other check was returning
a 200 OK instead of a 304 Not Modified, when each one should be a 304
until there's actually new updates to report. This was due to the wrong
value being set in the Last Modified header, since we converted the
timestamp to ISO8601 format too soon. We now set the correct timestamp.
Fix extra Last Update check timers firing after changing issue statuses.

Every time we resolved or reopened an issue, we'd register again for
updates to the review request. However, we already had a check going, and
each new one caused a new check. This could mean we'd hammer the server
eventually.

We now have a RB.ReviewRequest.markUpdated function that sets the
last updated timestamp. We use this instead when resolving an issue. It
ensures that we don't interfere with the existing checks, but we do mark
that we know when the last activity was.
Optimize most pages, but especially the diff viewer and diff fragments.

This is another round of optimizations to reduce query counts on pages.

In general, most pages will now have at least 1 less query. Some will
have 2 or 3 fewer.

The default session backend caused one query per view that always looked
up the session in the database. This was one of the first queries
executed. However, Django has another backend, cached_db, that will
first attempt to look up the data in memcached, and if it doesn't find
it, it will fall back to the database and then populate that data in
memcached. It's much faster, and saves one query per page.

The @valid_prefs_required decorator looked up the user's profile using
get_or_create, meaning the profile never got cached for the user. This
resulted in an additional profile query later on in most cases. We now
use get_profile() optimistically, and fall back on logic to create it.
This affects many pages on the site.

The My Account page got similar optimizations to reduce query counts, as
did get_enable_highlighting (used in diff generation).

The big changes though are to the diff viewer/fragment code. In
view_diff_fragment, we had one query for the DiffSet, another for the
interdiff's DiffSet (if specified), another for the FileDiff, and
another resulting one later for the FileDiff's DiffSet (since it wasn't
cached). And that was just for the core diffviewer's view_diff_fragment.
The wrapper in reviews added another one for the DiffSet and one for the
interdiff's DiffSet.

This was cleaned up to only have two queries total. One to fetch both
DiffSets (or just one if not doing an interdiff) at once, and one to
fetch the FileDiff. We grab the correct objects out of the query and we
assign the diffset to the FileDiff so we don't look it up again later.
view_diff_fragment now also accepts IDs instead of objects, so the
reviews wrapper doesn't need to do a fetch and pass it off.

This is a savings of 3-5 queries per fragment.

The other savings is in _query_for_diff, which would call
review_request.diffset_history and get_draft(user). The former was
unnecessary, since all we needed was the ID, so we save a query by
referencing the ID and not grabbing the object itself.

The get_draft(user) was a bit redundant. Many of the call sites already
had a draft. Now it no longer makes its own call, and instead requires
that a draft be provided.

All told, we save quite a few queries now, and every page (and API call)
has at least 1 fewer query (assuming the session is in the cache).

Some highlights:

The diff viewer (minus subsequent fragments) went from 20 to 16 queries.

Individual diff fragments went from 14 to 8.

The My Account page went from 10 to 7.
Merge branch 'release-1.6.x'
Fix close messages with the new optimizations.

In the old code, we were modifying data in the ChangeDescription's info,
when we were normalizing for display. This was a hack and only worked
because the latest_changedesc we grabbed was a separate copy from any of
the ChangeDescriptions we were modifying.

In the new optimized code, that's no longer the case. We're operating on
the same copy. This caused the status string comparisons to fail, since
we changed the names to human-readable strings. Now we make a deep copy
of the data we intend to modify so that doesn't happen.
Merge branch 'release-1.6.x'
Add release notes for the upcoming Review Board 1.6.10.

The release is still days away at the earliest, but this covers what
will be in the release.
Add release notes for the upcoming Review Board 1.6.10.

The release is still days away at the earliest, but this covers what
will be in the release.
Fix the timesince indicator when showing a value less than 1 minute.

When showing a value less than 1 minute, an empty string was being
returned. We were checking if seconds were 0, but we wanted to check
minuts.
Support for the latest CVS diff format

Added support for the latest CVS diff format while maintaining backwards
compatibility. In the latest format, file revisions are appended with ":" to the
file name. Example:

diff -u repo/test/testfile:1.5.2.1 repo/test/testfile:1.5.2.2
--- repo/test/testfile:1.5.2.1	Thu Dec 15 16:27:47 2011
+++ repo/test/testfile	Tue Jan 10 10:36:26 2012

Currently, only the origin revision is used (ex. 1.5.2.1)

Testing done:
- Created an additional unit test.
- Created reviews using CVS 1.12.13 diffs.

Reviewed at http://reviews.reviewboard.org/r/3187/
Additional changes from David: fixed some formatting, and changed the inline
diffs in CVSTests to be a bit more readable
Don't rstrip off more than ,v from CVS paths.

In cases where a filename in CVS ended with "csv,v", calling rstrip(',v') would not
only cut off the ",v", it would cut off "v,v". A simple change to use slicing
instead of rstrip fixes this.

Fixes bug 2613.
Don't rstrip off more than ,v from CVS paths.

In cases where a filename in CVS ended with "csv,v", calling rstrip(',v') would not
only cut off the ",v", it would cut off "v,v". A simple change to use slicing
instead of rstrip fixes this.

Fixes bug 2613.
Added "Show changes" links to interdiffs in changedesc blobs.

When a user uploads a diff, we show a link to the uploaded diff revision. We
should also provide a linke to the interdiff, since that's what a lot of people
will want to see.

This is based on Curtis miller's change http://reviews.reviewboard.org/r/2810/
I've updated it to fix the remaining issues, and tweaked the text a little bit
("Show changes" instead of "Show changes").

Testing done:
Published a few versions of a diff and verified that the new link showed
what I expected to.

Reviewed at http://reviews.reviewboard.org/r/3225/
Show live relative timestamps in the datagrids.

The "X minutes ago" timestamps in the datagrids were still being
computed on page load. Now they're live, just like the rest of the UI.
Require Djblets 0.6.20.
Release Review Board 1.6.10.
Merge branch 'release-1.6.x'