Add signals to notify when fetching/checking a file started/finished.

These signals can be used to hook up code to perform an operation when
fetching files or checking the existence of files, or when knowing when
those fetches/checks are complete.

Along with this, the file in diffutils that did time logging of the
fetch operation has been moved into Repository.get_file, in order to
standardize it.
Add file caching to Repository.get_file and get_file_exists.

We had file caching before in the diffutils code before fetching a file.
This ensured that we would only have to perform this operation once per
path + revision (so long as it stayed in the cache).

That caching support has moved into Repository.get_file directly,
meaning that any call sites will get the cached copy, and not just those
going through diff code.

Along with this, I've finally added caching for get_file_exists. Prior
to this, if you uploaded a diff touching files more than once, we'd
check (and possibly fetch) those files over and over, which could be
expensive (and really hit the rate limits hard for GitHub, in some
cases).

The get_file_exists caching will first check to see if we've already
determined if the file exists. If not, it will check to see if we have
actually fetched the file (using get_file) before, and if so, we
consider the file to exist. Otherwise, we get it from the repository.
Either way, we store that the file was fetched, for future lookups.
Add the missing signals for file fetching/checking.
Fix a 'request' assertion error in e-mails.

E-mails don't have a 'request' parameter, and so this was generating a
traceback e-mail. Unfortunately, this ended up inside the review e-mails
people saw.

Now the request is optional, rather than required. Confirmed that this
fixes e-mails.
Handle invalid repositories with Mercurial.

Mercurial wasn't doing any repository validation, meaning a broken
repository path could be used. It also didn't catch the connection
attempts later, causing HTTP 500 errors.

We now have a check_repository that attempts to connect, and some sanity
checking when connecting later on, to make sure users see that something
is wrong.
Fix replying to file attachment comments when the file attachment is removed.

Commenting on a file attachment, then removing the file attachment, then
replying to the comment was broken. This was due to looking up the
associated review_request only using the relationship for active file
attachments. We now check the inactive_review_request relationship too.
This is something that screenshot comments already do, but that fix
never made it to file attachments.

A unit test was added for this.