Merge branch 'release-1.7.x'
Allow superusers to access private repositories.

Trivial patch to allow superusers access to all repositories.

Fixes bug 3118.
Clean up reviews/urls.py.

This cleans up reviews/urls.py by separating out rules with common
prefixes into urlpatterns that can be included.

There are still some prefixes that remain across rules within a
urlpatterns block (the review e-mail previews), but those seemed to make
more sense kept together.
Provide raw downloading of files in the diff viewer.

The diff viewer now shows a download icon next to the revision
information for each file, allowing the original or new versions of a
file to be downloaded. This also works with files on interdiffs.

This can be used for easily downloading a patched file at any stage of a
diff revision range, or generating a diff based on the original and
modified files outside of Review Board.

Binary files use this as well instead of the previous "Download" links.
The existing actions lists remain, but won't be shown unless there's
content on either side. That can happen if there's a "Review" or
"New Comment" link.
Fix 'enter' in autocomplete fields (reviewboard)

Handling of the 'enter' key for autocomplete fields like people and groups
wasn't correct, because the djblets handler (which submits the field) was
running before the autocomplete handler (which populates the field with the
current selected item).

The fix is to ensure that the keydown handlers run in the other order. This
change does the review board side of that, using the new 'deferEventSetup'
option to avoid connecting the events until after we set up autocomplete.

Testing done:
Reproduced the bug. After this fix (and the matching reviewboard one), I can
press "enter" with a selected user and it will properly populate the field.

Fixes bug 2779.

Reviewed at https://reviews.reviewboard.org/r/5283/
Cache comment issue counts on ReviewRequest.

ReviewRequest now has three new counters for tracking the number of
issue states across all comments made on the review request.

These default to None for all existing review requests. When a review
request is accessed, all its counter fields will be initialized in one
go. Any time the state of an issue on a public review is changed,
the counter will be updated.

This will be used in future changes for the API and for the dashboard.
Bump the Djblets requirement to 0.8alpha3.dev.
Fixed JavaScript unit tests for file attachment thumbnails.

The file attachment HTML changed a bit, breaking some assumptions in the
unit tests. This updates the unit tests for these changes.
Concatenate raw diffs as bytes.

The raw diff method was concatenating all the individual file diffs using '',
but those file diffs may be undecoded string data that doesn't parse as
unicode. This changes it to use b''.

Trivial change.
Fix a bad assumption in the new binary file download logic.

The new logic for showing download icons for binary files made the bad
assumption that there was a FileAttachment we could query. We'd fail if
not.

We now check if the attachment is truthy before attempting to get the
URL.
Add API fields for review request counters and add new query args.

The Review Request resource now provides fields for `ship_it_count`,
`issue_open_count`, `issue_dropped_count`, and `issue_resolved_count`.

Callers can filter these for exact matches by passing, say,
`?ship-it-count=<value>`. It can also filter through ranges by
appending `_lt`, `_lte`, `_gt`, or `_gte` on the query parameter.
The results will be filtered accordingly.
Add the server info and capabilities to the root resource.

Nearly every client request RBTools makes needs to fetch both the root
resource and the server info resource.

The server info is pretty useful for most clients, especially the
capabilities and version information, so putting it in a separate
resource basically just results in one extra request.

Since the data is cheap and useful, it's now located in the root
resource. The server info resource still exists and mirrors the same
data, but clients can now check the root resource first.
Reduce the fadeout delay of the Loading indicator.

The Loading indicator was given a 1 second delay in order to not just
flash on and off on some requests, so that users can see that their
request had indeed started and finished.

1 second is a while, so this drops it down to 250ms. Testing with my
local server, it was on the screen just long enough to show the request
started and completed, but short enough to feel like the request
finished quickly.

This should give the perception of a large speed boost.
Include the LocalSite's public flag in the admin UI listing.

This is a useful enough flag to list, so show it in the list of local
sites in the admin UI.
Fix bugs in "Depends On" field.

The depends on field had some lingering problems:
* Change descriptions weren't rendered properly, just saying "added" and
  "removed" without actually including the IDs that were changed.
* Creating a new draft wouldn't copy over the old values, which meant that
  making unrelated changes would clear out the field.

Testing done:
* Added and removed a bunch of dependencies.
* Ran unit tests

Fixes bugs 3073, 3139

Reviewed at https://reviews.reviewboard.org/r/5294/
Show open issues instead of Ship It! in the dashboard and reviews.

The dashboard now shows the number of open issues instead of the number
of Ship Its if there are open issues. If there are no open issues left,
the Ship Its are displayed instead. This makes it a lot easier to see at
a glance on the dashboard if a change is ready to go in, or if work
still needs to be done.

On a review box, "Ship it!" will be replaced by "Fix it, then Ship it!"
when there are open issues. As soon as they're all resolved for that
review, the text will be replaced by "Ship it!" Likewise, re-opening an
issue will flip the text back to "Fix it, then Ship It!"
Add subvertpy as an alternative to PySVN

"subvertpy" is a new python library for subversion which has the distinct
advantage of being installable with easy_install. This change generalizes the
SVN SCMTool to use either subvertpy or PySVN, depending on which one is
installed.

Testing Done:
* Made sure there were no regressions in the unit testsuite (Python 2.7,
  Linux), and made sure that PySVN still works.
* Light manual testing (Python 2.7, Linux).

Reviewed at https://reviews.reviewboard.org/r/5104/
Mark quick ship-it reviews as rich text.

This doesn't actually have any effect on normal quick ship-its, but will make
the ship-it ascii art extension nicer.

Reviewed at https://reviews.reviewboard.org/r/5295/
Make "Auto-Submitted: auto-generated" header optional with a settings flag

Some mailing lists filter out emails containing the "Auto-Submitted:
auto-generated" header. Making this header optional allows those who use such
mailing lists to receive Review Board emails.

Testing Done:
* Manually enabled and disabled the header settings flag in E-Mail Settings.
* Ran unit tests.

Bugs closed: 2646

Reviewed at https://reviews.reviewboard.org/r/5276/
Show discarded review requests in the "All Review Requests" view.

For some reason, we chose to filter public discarded review requests out of the
list view. This made it very hard to find old changes that had been closed out
for some reason (they were only available in the submitter lists). This change
includes them along with "Submitted" review requests, and changes the show/hide
toggle to be "closed" instead of "submitted".

Testing done:
Discarded a review request. Saw that I could see it in the "All Review
Requests" view. Checked that "Hide closed" filtered out both submitted and
discarded review requests.

Fixes bug 576.

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