Pushing to a new repo before working copy is created results in 500 internal server error

Steps to reproduce:

  • In Phabricator/Diffusion, Create a new HG repo
  • get its http URI
  • from a local machine, attempt to push to that repo

Chances are, by the time you are attempting to push, the working copy of the repo hasn’t been created by the daemons yet.

Expected behavior:
Ideally, the push should succeed, and the pushed data should be stored somewhere and queued to be processed by the daemons later.

Now, maybe this is not possible at all for several reasons.
So, the next best thing to do is to respond with a sensible error message that tells the client exactly what’s going on: that the repo working copy hasn’t been created yet. NOTE: not just a generic “unknown repository” or “repository not available” or “I don’t know what you are talking about” response. The server knows that the repository “exists”, that the uri being pushed to is valid, that the user attempting to push has access to it; it’s just the working copy is not available so the push operation can’t be completed (because I guess you would need to compare to the working copy to see whether there are changes, etc - otherwise, you could as I said even accept the push and queue it, but I’m assuming that’s not possible). So, there is enough information to give a very specific response.

I’m not sure how “custom” the response to a push request can be, but certainly you can do better than “500 internal server error”.

See https://secure.phabricator.com/T12389.