Mercurial "server"

Viewed 33639

I've been using Mercurial for a little while, but mainly for my own use. Now though, I have a project I'm working on where two of us are building the same project, and we will probably be modifiying each other's files.

I would like to setup a Mercurial repository on a server, make that repository the "server", so my changes and the other editor's changes both push to that server (so basically the Subversion / CVS model); I like Mercurial though and don't want to switch to something like Subversion.

Here in my own network, everything is done on Linux, and my "server" has OpenSSH installed. So pushing my changes (I work on multiple computers) from one computer to the server is just a matter of "hg push"; the protocol used is SSH for transfering the changes.

The problem is that I use Linux, the server will be Windows (so no OpenSSH, right?) and the other editor will be using Windows too. As far as I know, the best way of working in Mercurial in these types of setups is for the repository to pull changes from the source, rather then the source pushing to the "server". I'm behind several firewall's (not entirely my network) and my computer won't be visible from the server, and I'm assuming the other editor will be behind a firewall too (so we can't just start up the local Mercurial HTTP server and get the "server" computer to pull from that).

What's the best way for both editors to get our changes to the server repository? (I should add that the server is a server on the Internet, so it is just as visible as something like google.com. It's a hosted Windows server, but I would probably have permission to install software if needed for this.)

14 Answers

It might also simplify the administration to outsource it -- if you only have one repository and a couple of guys pushing/pulling it, you could do a lot worse than just hosting it somewhere like Bitbucket. (And for a one-repository solution it's actually free.)

Update: It is 2020 now and Bitbucket no longer supports mercurial, see: https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket

For a list of hosted or self hosted free or paid solutions see https://www.mercurial-scm.org/wiki/MercurialHosting

There are certainly many SSH servers available for Windows. Here are two examples:

Check out the Putty examples in the Mercurial: The Definitive Guide book for the Windows user connectivity.

You could use SCM-Manager to share your repositories over http oder https.

Mercurial and PuTTY is a well supported and a well documented solution.

The simplest solution seems to be to use Samba shared folders, especially in Windows-only environment. I've just set it up, seems to work.

As far as I know, the best way of working in mercurial in these types of setups is for the repo to pull changes from the source, rather then the source pushing to the "server".

There is no "best way of working" that I know of? There's a multitude of possible work flows that Mercurial supports, and the even list them in their guide. I'm actually using the "svn-ish" set-up, where I develop in a local repository, and have several repositories on a shared server. If there are any changes, I push them into the central repository. I push them over HTTPS, and I've (naturally) limited push abilities to developers only. It's a great way of working.

I can understand people want the central repository to pull the changes over from the clones the developers made, but there is nothing stopping you giving yourself and your co-worker a dedicated repository on the shared server, from which the central repository is able to pull.

You might want to reconsider your thoughts on the matter pushing v pulling?

Related