gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 23:36:44 26 4
gpt4 key购买 nike

我有一个通过网络克隆到 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com