克隆文件系统时的 Mercurial 锁
Mercurial lock when cloning over a filesystem
在 Windows 环境中通过 http 克隆 Mercurial 存储库时,我得到以下输出:
hg clone http:/myserver/hg/repo hgcopy
requesting all changes
adding changesets
adding manifests
adding file changes
added xxx changesets with xxx changes to 92985 files
updating to branch default
92985 files updated, 0 files merged, 0 files removed, 0 files unresolved
通过文件系统克隆,即通过共享网络驱动器,给出完全不同的输出:
c:\Hg>hg clone \server\Hg\Repo c:\Hg\Repo
copying [ <=> ] 23712
updating to branch default
92985 files updated, 0 files merged, 0 files removed, 0 files unresolved
最后一个操作快了 3 倍,但在远程仓库中创建了一个锁定文件,使得无法从另一个系统启动第二个克隆。 Mercurial docs about Locking Design 没有透露太多关于它的信息:
Possible problems can occur if a reader reads files out of order. For instance, copying a repository with other tools (rsync, for instance) during a pull or commit may result in copying a changelog refers to a manifest entry that isn't in the copy.
那么,克隆文件系统时发生了什么样的机制?
那些不是堆栈跟踪,它们只是普通输出。
Mercurial 在使用 "fast copy" 通过复制或硬克隆时锁定源存储库 link 恰好 因为 这不使用较慢的 "pull protocol".你可以 运行:
hg clone --pull \server\Hg\Repo c:\Hg\Repo
强制 Mercurial 无论如何都使用拉取协议:有关详细信息,请参阅 hg help --verbose clone
。这将比直接复制慢,但可能不如通过 http
或 https
克隆慢(因为 HTTP 需要通过您的 Web 服务器传递所有数据)。
在 Windows 环境中通过 http 克隆 Mercurial 存储库时,我得到以下输出:
hg clone http:/myserver/hg/repo hgcopy
requesting all changes
adding changesets
adding manifests
adding file changes
added xxx changesets with xxx changes to 92985 files
updating to branch default
92985 files updated, 0 files merged, 0 files removed, 0 files unresolved
通过文件系统克隆,即通过共享网络驱动器,给出完全不同的输出:
c:\Hg>hg clone \server\Hg\Repo c:\Hg\Repo
copying [ <=> ] 23712
updating to branch default
92985 files updated, 0 files merged, 0 files removed, 0 files unresolved
最后一个操作快了 3 倍,但在远程仓库中创建了一个锁定文件,使得无法从另一个系统启动第二个克隆。 Mercurial docs about Locking Design 没有透露太多关于它的信息:
Possible problems can occur if a reader reads files out of order. For instance, copying a repository with other tools (rsync, for instance) during a pull or commit may result in copying a changelog refers to a manifest entry that isn't in the copy.
那么,克隆文件系统时发生了什么样的机制?
那些不是堆栈跟踪,它们只是普通输出。
Mercurial 在使用 "fast copy" 通过复制或硬克隆时锁定源存储库 link 恰好 因为 这不使用较慢的 "pull protocol".你可以 运行:
hg clone --pull \server\Hg\Repo c:\Hg\Repo
强制 Mercurial 无论如何都使用拉取协议:有关详细信息,请参阅 hg help --verbose clone
。这将比直接复制慢,但可能不如通过 http
或 https
克隆慢(因为 HTTP 需要通过您的 Web 服务器传递所有数据)。