1

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.

Martin Geisler
  • 1,271
  • 9
  • 23
jjfine
  • 123
  • 3

2 Answers2

2

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.

  • 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 02 '10 at 09: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á Maia Apr 08 '10 at 06: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
1

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.

tonfa
  • 301
  • 1
  • 3