branchmap: acquires lock before writting the rev branch cache
We now attempt to acquire a lock and write the branch cache within that lock.
This would prevent cache corruption when multiple processes try to write the cache
at the same time.
ERROR: FIXME: This is a known failure of filelog.size for data starting with \1\nOK.