Move locking out into it's own method to avoid duplication of code
Lets get the git revision dumped out into a file.

We pull this back in before doing anything so that the 'from' field is hopefully now accurate,
and we have the on disk expected sha for easier debugging