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
Use a ReadOnlyGitRepository for master repos

These are bare anyway, so we don't (generally) write things to them.
By allowing concurrent shared access to these we avoid causing
requests to fail just because they can't get a lock they don't
actually need.

Similarly, the source repo the CheckoutHelper uses only needs to be
read, so use a read-only repo there too.

Change-Id: Ica224f0a25fe8e2fc8ac95b2041255183cec3980