Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 526
j-g-faustus Avatar asked May 11 '10 11:05

j-g-faustus


People also ask

How do I fork a repository on mercurial?

Forking is as simple as cloning the repo. When it comes to creating the fork on your server, that depends on the software your server runs - especially if you have no access to the server... a login would greatly help. Otherwise make sure that you have the server run a software like kallithea.

What is a Mercurial repository?

Strictly speaking, the term repository refers to the directory named . hg (dot hg) in the repository root directory. The repository root directory is the parent directory of the . hg directory. Mercurial stores its internal data structures – the metadata – inside that .


2 Answers

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
like image 172
Ry4an Brase Avatar answered Nov 15 '22 12:11

Ry4an Brase


Update

I tried using Dropbox as described below, but couldn't make it sufficiently reliable, so I'm not recommending that option.

Original answer below, kept for context.

/update

I found one more option: Skipping both http and ssh altogether and using Dropbox for shared repos.

For the one-person-multiple-computers scenario, it looks like the simplest option of the lot, and you get backups as a nice side effect.

Here is a discussion on Hacker News

like image 40
j-g-faustus Avatar answered Nov 15 '22 12:11

j-g-faustus