I'd need to know whether the following methodology is going to work with Mercurial:
I have two computers for work (notebook and PC, both on Windows). I want to be able to carry all of my work between the two offline (say, on a flash stick). When I finish my work, I backup my working directory and carry it to the other computer, where I copy the files back into the same location. This works well in the environment I'm currently using.
Now I would like to use Mercurial for version control, generally because I'd like to be able to use the version control even when I'm not connected to the server in the office. Can I create the repository on one of my computers and then carry it (offline) to the other computer together with my working directory? I don't plan to ever synchronize the two repositories against one another, just copy the repository as a whole between the two computers.
Does anybody know whether it is safe to copy the repository this way? My gut feeling is that should be possible, it is akin to restoring files from a backup to a new PC, however I wouldn't like to find out the opposite when I've several months of history already stored in Mercurial...
Yes, you can copy the repository this way. It is just a folder which contains all necessary information.
But, because the work directory contains the repository with a whole history, each copy will be bigger and bigger. So may be the better way is to have 3 repositories - two on working computers and one on flash stick and synchronize between them (Notebook <-> Flash <-> PC). It will work if you didn't synchronize the Mercurial with SVN.
And the best way (IMHO) to work on two computers that doesn't connected by network is USB (eSATA) HDD. Just one repository which you connect to the current computer. USB stick is not suitable foe such scenario because is very slow.
Thank you very much for your answer and suggestions.
I'm aware of the repository growing in size, but I've got pretty fast USB stick actually. Moreover I plan to copy only files that were changed; I currently do it for the whole of my working directory which has some 8 thousand folders and around 14 GB in size (it contains some DB dumps too). It is a matter of a few minutes. The added (but very important) benefit of this workflow is that I'll have a full backup of the entire repository every day.
I'm still learning Mercurial, but I thought that when I sync two repositories, they will both contain full history. Is it the case? I plan to setup a "central" repository; I'd need to be able to share the full history via this central repository with other workers somehow. Could you please let me know whether pull and push will do this for me?
Joined: Sep 21, 2011
I am not suggest to do the synchronization manually - you will have the different history trees on your notebook and PC. Also I am not sure that it is possible to do raw diff between two separate repositories and copy only changed files. If you want to correct transfer the changes between repositories using the push/pull is much more better even if both repositories are located on the same computer. Or you can use the "hg bundle" command to create the change set bundle and then import it to another repository (you can use also the patches but it will work only with text files).
Yes, the synchronized repositories usually contains the full history. And you are right - the push/pull commands will do it for you.
Thank you again. I've experimented with Mercurial in these days and I'm more confident now.
I'll probably try the "manual synchronization" anyway (the repository will sit deep in my working directory, and I already synchronize this directory against the flash stick; I'd have to change this). Of course I'll make sure no other activity takes place in the repository during the copy. I'll just run hg verify after the copy to make sure it didn't went astray.
I take it I was warned. If I get burnt, I'll hg blame myself
subject: Mercurial: copying whole repository between computers