Search code examples
mercurialproject-structure

How do I push a new project to a shared Mercurial multi-repository?


I have a local machine ("laptop") and a shared Mercurial repository on another machine ("server").

The shared repository is set up as a multi-repository as described in the Mercurial documentation using Apache, the hgwebdir.cgi script and Mercurial 1.4.

The setup works in the sense that I can browse the projects (repositories) in the web browser, I can clone and pull from the server, and I can push from the laptop when the project/repository already exists on the server.

But I cannot create a new project on the laptop (hg init, do stuff, hg commit) and push it to the shared multi-repository (hg push http://server/hg/my-new-project-name) - I get "abort: HTTP Error 404: Not Found", presumably because the directory/project repository does not exist yet.

How can I push a new project/directory structure to a Mercurial running elsewhere? I couldn't find anything in the documentation, how do you guys do it?


Solution

  • You cannot create new remote repositories over http with the built-in functionality. Your options are to either:

    1. create with a ssh clone: `ssh clone local-repo ssh://you@remote//path/to/repo'
    2. log in to the remote repo and do a hg init where you want the repo. After that you can push to the new empty repo
    3. Use a cheesy http-creation CGI like the one I wrote here: http://ry4an.org/unblog/UnBlog/2009-09-17