Question

I've got a Win7 x64 box running Tortoise 1.0 x64 release. About Tortoise reveals that it's 1.0 "with Mercurial-1.5, Python-2.6.4, PyGTK-2.16.0, GTK-2.18.7". I've also got ActivePython 2.6 and Mercurial 1.5 x64 installed (installed via the Mercurial installer from the 64-bit installer. Neither one clone with Hard Links on my windows box. The drives on my box are also NTFS, which supports hard links.

In deed, when I run the python interpreter and execute a hard link creation via the win32file api, it creates a link successfully:

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

However, if I use Mercurial to clone, I don't get the same results:

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

Does anyone have cloning working on Windows with hardlinks being used or is it not supported? I noticed that the TortoiseHg installer comes with a Python 2.6 installation. Also noticed that it has it's own Hg executable (which I've also tried and get the same results). Could the TortoiseHg and Mercurial installations be causing problems?

Was it helpful?

Solution

Yeah, you got the answer: the hardlinking is in the repo (.hg) not the working directory. Thus, if you create a clone with -U your clone takes up no additional diskspace. A no-working-dir clone is a great option on the server side, and sometimes useful on desktops too. If you forget the -U you can always get rid of a repo's working dir with hg update -r null which updates to the null revision, which predates the adding of any files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top