复制 .hg 文件夹和使用克隆有什么区别?
假设我需要创建可以从中央存储库推送和拉取的 x 存储库。与将 .hg 文件夹从中央存储库复制到空文件夹 x 次相比,克隆所有这些存储库之间是否有实际区别?
Say I need to create x repositories that can push and pull from a central repository. Is there a practical difference between cloning all those repositories compared to copying the .hg folder x times from the central repository to empty folders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我能想到的一个区别是复制不是原子操作:
您无法确定您正在复制的存储库没有被修改。
编辑:实际上
hg clone
手册页提到:One difference I can think of is that a copy isn't an atomic operation:
you can't be certain the repo you are copying isn't being modified.
Edit: the
hg clone
man page actually mentions:另一个细微差别 - 如果执行复制,原始存储库和新存储库将具有相同的父存储库。通过克隆,新存储库的父级将是原始存储库。
即在 .hg/hgrc 文件的 [paths] 部分中。
原始存储库 (/repo/hg/original)
复制存储库
克隆存储库
Another minor difference - if you perform a copy both the original and new repository will have the same parent repository. With a clone the new repository's parent will be the original.
i.e. in the [paths] section of your .hg/hgrc file.
Original Repository (/repo/hg/original)
Copied Repository
Cloned Repository
是的,有一点不同。如果两个存储库位于同一文件系统上,克隆将尝试创建硬链接。 (不幸的是,这在 Windows 上不起作用)
Yes, there is one difference. Clone will attempt to create a hard link if both repository are on the same filesystem. (Unfortunately, this doesn't work on windows)