Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a very simple Windows install of Mercurial on my machine. The 'central' repository is located at //mymachine/hg-repos/central.

I want remote (VPN) users to be able to create clones of this repository in the hg-repos directory because it gets daily backups. I have given these users full control of the hg-repos directory. My question is this:

If I'm on a remote machine, and I run the command:

hg clone //mymachine/hg-repos/central //mymachine/hg-repos/central-copy

is the remote machine doing most of the work?

I don't want the client to have to download all of the central repository and then upload it all back because people are going to be using this from across the country. But I suspect this is what's happening here since it works so easily.

share|improve this question
add comment

2 Answers

It should only do a the equivalent of cp -r, followed by hg update. It should be a bit more efficient than a download+reupload.

share|improve this answer
add comment

Your command is running locally (after all, you are running "hg" executable from the local machine). The parameters are both remote mounted directories, and they behave as local directories. Thus, the local "hg" program works as if it was working with local files.

Is it "better" than download/reupload? I don't know, it depends on how the operating system handles "copy" operation on remote directories. Maybe it has a primitive to send a "copy" command to the server, but I really doubt that.

My bet is that it is reading the entire directory tree, and probably downloading/uploading all file contents.

share|improve this answer
    
That would be my bet too. Mercurial is asking the OS to make a lot of hard links between the files in .hg, and that might be cheap on the network mounted directories. But the files in the working copy are updated by downloading them and writing them back over the network. –  Martin Geisler Apr 2 '10 at 9:52
    
Are you sure Mercurial uses hard links? I've checked one of my repositories here, and I see no hard links. Also, I doubt it uses hard links, since this feature is not very portable (and is also quite annoying to work with). –  Denilson Sá Apr 8 '10 at 6:48
    
I'm quite sure. It creates hard links inside the .hg folder and automatically breaks them as needed. This makes hg clone foo bar very fast and space efficient. Even NTFS supports hard links so it works on all three major platforms. –  Martin Geisler Dec 22 '11 at 23:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.