Avoid repeat creation of repo wrappers we already have

Have the updateRepository method accept a repository instance rather
than fetching one itself. This avoids the need to re-check the repo
is valid, get a lock (etc.) which is redundant given that in both
real usages we already need a handle on the repo anyway.

This is likely to improve the success rates of the file/* endpoints
as they only need to get the lock on their target repo once, rather
than twice per request.

Change-Id: I9bf2dbdbe8681d4c3988c5a21a970d28bd6496de