Perform merges from Rails in a temporary and unique repository
This should improve greatly the robustness of all merges initiated from the Rails application (Web UI or API) in cases where several unrelated merges are happening at about the same time.
We also take the opportunity to clean that code up, which was direly needed.