problem cloning large file (32MB) on Windows/Network Shares

Steve Borho steve at
Fri Jan 14 09:03:41 CST 2011

On Fri, Jan 14, 2011 at 2:10 AM, Adrian Buehlmann <adrian at> wrote:
> On 2011-01-14 03:29, Steve Borho wrote:
>> On Thu, Jan 13, 2011 at 7:59 PM, rollin <rollinforall at> wrote:
>>> Well, I currently only have a binary distribution; and building 3rd party
>>> apps on windows is a pain most of the time.  is it possible for you to
>>> supply me with the hg.exe (and/or whatever dll's) that I can just try out?
>>> if not, I guess I could download the source; read up on building in windows
>>> (and hopefully not requiring cygwin); build it; learn about applying a
>>> patch; and, finally, testing it.  This will take me some time.
>> Building Mercurial on Windows is involved, but does not require
>> cygwin.  You do however need VC2008, which is available for free via
>> the Visual Studio Express, or the Windows SDK.  Getting the C compiler
>> is the hardest part.
>> Beyond that you need to install Python (2.6 or 2.7 recommended) and
>> pywin32, clone the Mercurial source repository, then run 'python
>> install'.
> I have Python 2.6.5 installed here (I should probably upgrade, finally) and
> multiple versions of VC++ (one of the free Express should do as Steve said).
> The most interesting part is building Mercurial's C modules for Windows.
> I often do:
> - Delete the 'build' directory in your clone (if it's there)
> - In a command shell in the repo root (e.g. C:\Users\adi\hgrepos\hg-main) do:
>  $ python build
>  C:\Python26\lib\site-packages\py2exe\ DeprecationWarning:
>  the sets module is deprecated
>  import sets
>  running build
>  running build_mo
>  running build_py

A trick here is to use:

python build_ext -i

This compiles just the C extensions, in place where they belong.
It's the Windows version of "make local'.  It does not try to build
the locales, etc, which require gettext to be installed.

>  creating build\temp.win32-2.6\Release
>  creating build\temp.win32-2.6\Release\mercurial
>  C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
>  /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\include -IC:\Python26\PC
>  /Tcmercurial/base85.c /Fobuild\temp.win32-2.6\Release\mercurial/base85.obj
>  base85.c
>  ..
> this will create the build directory. Inside you will find the compiled
> C modules in build\lib.win32-2.6\mercurial. Copy all *.pyd files into the
> mercurial directory.
> Now the mercurial directory of the clone should be ready to be run by
> Python.
> For convenience, I have a batch file 'hgm.cmd' in my path, containing (I'm
> on Windows 7):
>  @echo off
>  set cmdpath=C:\Users\adi\hgrepos\hg-main
>  echo --- running hg from %cmdpath%
>  python "%cmdpath%\hg" %*
> Thanks to that, I can then call my self "built" mercurial using 'hgm':
>  $ hgm id
>  --- running hg from C:\Users\adi\hgrepos\hg-main
>  447805c2f1e0 tip
> I have various other 'hgX.cmd' files, for different versions of mercurial in
> different clones.
> The "building" is really only building the C modules of Mercurial. The *.py
> files of mercurial are ready to be run by Python as is.

Steve Borho

More information about the Mercurial mailing list