views:

103

answers:

3

I currently use Perforce for source control, but want to start working on the code from 2 different PCs at the same time (desktop and laptop). The laptop would not be able to access the perforce server very often, which makes Perforce a poor choice in this setup.

Distributed source control tools like Mercurial seem better suited to the task, but I am still not clear if this would work or not. Does anyone have any experience of using Mercurial to work on 2 machines at once (eg desktop in the week, laptop in evening and weekends). Does it help, or is it still a pain the butt keeping everything in sync and knowing what is going on.

+5  A: 

Yes, I've been doing that for the past 2 years between my work computer and home computer. You can either use Mercurial or Git, they're both quite good. I prefer Mercurial because it relies only on python which is really easy to install on Windows, Linux and Mac OS X.

Also, since it's mostly only you working on the project you won't have very many problems with conflicts.

ruibm
+1  A: 

I have no experience with mercurial, but with git. My experiences are very good. A DVCS is very appropriate for a situation like yours. Most of the actions can be done offline, so it would not be a problem when working on your laptop.

Once you have a connection again, you just synch everything back up, and you can work on your other pc.

Ikke
+2  A: 

Mercurial is perfect for this type of setup. Basically each computer has a full copy of the entire revision history, and if you need to branch or tag releases, you can do everything against your local repository. Then all you have to do is push back to your remote repository when you're finished working on one machine. The remote repository could be on a third party site (like bitbucket) or you can roll your own with SSH or file shares. Either way it's simple to set up. I recently wrote a blog post on how to get Mercurial running an HTTP-based repository under Nginx with FastCGI (Ubuntu 9.10).

Mercurial is super fast (like git) because it works against your local hard drive instead of having to hit a server for every task. The only thing you can't do without a connection is push back to your repository, so it would work nicely in your situation where the laptop has limited connectivity.

Just make sure that you pull changes down from the repository before you start your work and then push them back when you're done. Keeping the two machines in sync is pretty simple. I recommend learning the command-line tools, though, even if you plan on using TortoiseHG or some other similar client, because the command line is easier to work with in some situations.

Scott Anderson
Actually with `hg serve` you'll only need the two local repositories (a third "remote" repository is not needed). A third repository may still be nice as a backup.
Thomas Jung