Difference between cloning and copying in Mercurial

随声附和 提交于 2019-11-30 08:11:54

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!