【问题标题】:How to get hardlink cloning on Windows如何在 Windows 上进行硬链接克隆
【发布时间】:2011-02-01 04:32:38
【问题描述】:

我有一个运行 Tortoise 1.0 x64 版本的 Win7 x64 机器。 About Tortoise 透露它是 1.0“与 Mercurial-1.5、Python-2.6.4、PyGTK-2.16.0、GTK-2.18.7”。我还安装了 ActivePython 2.6 和 Mercurial 1.5 x64(通过 the 64-bit installer 的 Mercurial 安装程序安装。在我的 Windows 盒子上没有一个带有硬链接的克隆。我盒子上的驱动器也是支持硬链接的 NTFS。

事实上,当我运行python解释器并通过win32file api执行硬链接创建时,它成功创建了一个链接:

me@pc C:\temp
> python
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from win32file import *
>>> CreateHardLink('C:\\temp\\Mike2.txt','C:\\temp\\Mike.txt')
>>> ^Z

me@pc C:\temp
> fsutil hardlink list Mike.txt
\temp\Mike.txt
\temp\Mike2.txt

但是,如果我使用 Mercurial 进行克隆,我不会得到相同的结果:

me@pc C:\Users\mcaron
> which hg
C:\Program Files (x86)\Mercurial\\hg.EXE
me@pc C:\temp
> hg status demo
mcaron@DEV-MCARON-W64 C:\temp
> hg log demo
changeset:   0:6db7092740d5
tag:         tip
user:        Michael Caron <mcaron@solidworks.com>
date:        Wed Mar 24 16:08:38 2010 -0500
summary:     first

me@pc C:\temp
> hg clone demo demo2
updating to branch default
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
me@pc C:\temp
> fsutil hardlink list .\demo\mike.prtprp
\temp\demo\mike.prtprp
me@pc4 C:\temp
> fsutil hardlink list .\demo\mike1.prtprp
\temp\demo\mike1.prtprp
me@pc C:\temp
> fsutil hardlink list .\demo\mike1_2.prtprp
\temp\demo\mike1_2.prtprp
mme@pc C:\temp
> fsutil hardlink list .\demo\mike2.prtprp
\temp\demo\mike2.prtprp

me@pc4 C:\temp
> hg --version
Mercurial Distributed SCM (version 1.5)

Copyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
me@pc C:\temp
> python -V
Python 2.6.2

是否有人在 Windows 上使用硬链接进行克隆工作,或者它不受支持?我注意到 TortoiseHg 安装程序带有 Python 2.6 安装。还注意到它有自己的 Hg 可执行文件(我也尝试过并得到相同的结果)。 TortoiseHg 和 Mercurial 安装是否会导致问题?

【问题讨论】:

标签: mercurial clone tortoisehg hardlink


【解决方案1】:

是的,您得到了答案:硬链接位于 repo (.hg) 而不是工作目录中。因此,如果您使用-U 创建克隆,您的克隆不会占用额外的磁盘空间。 no-working-dir 克隆在服务器端是一个不错的选择,有时在桌面上也很有用。如果您忘记了 -U,您始终可以使用 hg update -r null 删除 repo 的工作目录,该目录更新为空修订,该修订早于添加任何文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-25
    • 2017-09-17
    • 2019-06-17
    • 1970-01-01
    • 2020-09-26
    • 1970-01-01
    相关资源
    最近更新 更多