Don't pause if we got a lock

I'm not sure how this slipped through previously, as it adds 10ms
per lock to each request completely pointlessly. The biggest impact
this has is on the poll/poll endpoint, which iteracts with all the
user's projects, though all requests should be sped up by this fix.

Change-Id: I32854e6559f70ef8b5db367adb0f8db3338c2791
Make it possible to get shared locks on files

This will make it possible to greatly reduce the lock conflicts on
read-only access to repos, which make up a good portion of the
current failures in this area.

Change-Id: Idd3d7c0ee7d5504d6d91c15f6dd52099be263268
Get a shared lock on read-only repos

There's no need to get an exclusive lock if we aren't going to change
anything in the repo, we only need to be sure that no-one else is
changing it underneath us.

Change-Id: If320abf7ce6c144d57c97b2b691975388f244ba6