Merge Request creation by pushvars fails for native projects
Follow-up after initial implementation of pushvars: --pushvars merge_request.create
does not work for native repositories.
This is a problem for any synchronous processing done synchronously while handling the post-receive
call sent from the receiving end of the push: the Rails application wants to create the corresponding special ref, but the Mercurial locks are still held. In the case of MR creation, I suppose it is synchronous in order to provide the client with immediate feedback (link to the just-created MR).
I don't think it'd be wise to create the special ref in an async server-side worker, because the special ref might be needed sooner than that (not very easy to track, and prone to change upstream).
We will need to perform the special ref creation in the process that sends the post-receive
to the Rails application, and this will need more cooperation (MR id in the response). Of course short of doing a full 2-phase commit, there's no way to ensure full consistency and absence of race conditions, especially in error recovery. At least we'd be still have the Mercurial lock.
This is a bit scary for the future when HGitaly will be in charge of more writes (%HGitaly3: fully in charge), especially for the intermediate steps before we reach that point: all writes initiated by HTTP or SSH pushs or by direct server-side subprocesses will have to be very careful not to trigger a HGitaly write synchronously.