Is copying the .hg directory to another directory the same as cloning in Mercurial (using TortoiseHg although I think that's irrelevant) or does the cloning command in Mercurial do something special during that process?
Asked
Active
Viewed 1,805 times
1 Answers
30
It's almost the same. Cloning does a few things different, none of which are required, but some of which are cool:
- clones get a working directory too (which you can avoid with -U)
- clones get the source repo set as default for push/pull in the .hg/hgrc file
- clones can get just a subset of the original (clone -r X gets revision X and all ancestors only)
- clones use hardlinks when the file system supports it
That last one is pretty cool. It means that if I have a 200GB repo and I do a clone -U src dest
I get a full clone that uses no diskspace at all! If I skip the -U
I get a working copy that takes up space, and as the two clones start to diverge the new one starts taking up space, but a basic clone -U
is instantaneous and disk-space-free on modern file systems. That's not true of a copy (which does work just fine too).

Ry4an Brase
- 78,112
- 7
- 148
- 169