mercurial - 据说Mercurial的 "hg clone"很便宜...但是我的硬盘上有400MB? (在 Mac OS X Snow Leopard 上)

标签 mercurial

我有一个通过网络克隆到 Mac 硬盘驱动器 (OS X Snow Leopard) 的项目。

该项目硬盘约1GB

du -s
2073848 .

所以当我hg clone proj proj2

然后当我

MacBook-Pro ~/development $ du -s proj
2073848 proj

MacBook-Pro ~/development $ du -s proj2
894840  proj2

MacBook-Pro ~/development $ du -s
2397928 .

所以克隆版似乎没那么便宜...大概400MB左右...是这样吗?另外,整个文件夹增长了大约200MB,这不是proj和proj2的总和...是否有一些链接和一些不是链接,这就是为什么重叠不被计算两次?

最佳答案

如果可能,Mercurial 将在存储库数据上使用硬链接(hard link),而不会在工作目录上使用硬链接(hard link)。因此,它唯一可以节省的空间是 .hg 文件夹的空间。

如果您使用的编辑器可以破坏硬链接(hard link),则可以 cp -al REPO REPOCLONE 在整个目录(包括工作目录)上使用硬链接(hard link),但请注意,它有一些注意事项。引用自手册:

For efficiency, hardlinks are used for cloning whenever the source and destination are on the same filesystem (note this applies only to the repository data, not to the working directory). Some filesystems, such as AFS, implement hardlinking incorrectly, but do not report errors. In these cases, use the --pull option to avoid hardlinking.

In some cases, you can clone repositories and the working directory using full hardlinks with

$ cp -al REPO REPOCLONE

This is the fastest way to clone, but it is not always safe. The operation is not atomic (making sure REPO is not modified during the operation is up to you) and you have to make sure your editor breaks hardlinks (Emacs and most Linux Kernel tools do so). Also, this is not compatible with certain extensions that place their metadata under the .hg directory, such as mq.

关于mercurial - 据说Mercurial的 "hg clone"很便宜...但是我的硬盘上有400MB? (在 Mac OS X Snow Leopard 上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3036566/

相关文章:

svn - 具有 SVN 支持的 Mercurial 客户端 Windows

mercurial - : is commit A "reachable" from commit B 的 hg 语法是什么

git - 如何使用 git 完成与 mercurial 相同的工作流程?

mercurial - 修改推送提交的提交消息。 ( Mercurial )

mercurial - 乌龟HG : Removing commit

scripting - 如何在 Jira 中设置自动问题转换?

eclipse - 将文件添加到 Mercurial 控制的存储库

mercurial - 没有父级的 mercurial 修订是什么意思?

Mercurial:带参数的别名

regex - hgignore:帮助忽略除某些文件之外的所有文件