Using mercurial on windows.

Matt Harbison mharbison72 at gmail.com
Wed Jan 9 21:22:14 EST 2019


On Wed, 09 Jan 2019 16:16:02 -0500, Pulkit Goyal <7895pulkit at gmail.com>  
wrote:

> Hey everyone,
>
> Hope you are doing good.
>
> In past few weeks, I have been playing with mercurial on windows. During
> that time, I realised why windows support is so hard and was quite proud
> that hg support windows. Huge thanks to all the people who work on this.
>
> Now, I know things work because there is a windows buildbot which we try  
> to
> keep green. I tested, most of the times it works fine. But I was bit
> shocked to find there was no good documentation on how mercurial can be
> used on windows, what's preferred way to use, and what works and what  
> does
> not, what config knobs should be set, how to get started.

I'm not sure what you mean by "how it can be used on windows".

I can't think of any specific config knobs that are needed for Windows  
that aren't needed for other platforms.  (Editors and tools excluded, of  
course.)  If I remember tomorrow, I'll look through our setup scripts to  
see what we tweaked.

The only surprises that I can think of is that before Windows 10, ANSI  
color isn't supported by cmd.exe.  The default color.mode config is set to  
win32 mode instead, which sets console attributes.  That means pager  
effectively swallows color.  And the default more.com pager is fairly  
annoying.  Also be aware that you can't tweak +x bits, and they can get  
lost during a rebase.  (I filed a bug on the latter.)  EOL issues can bite  
you if you aren't careful if you import/export patches.

> After sometime of fighting with windows, here I am looking for  
> suggestions
> on how one can use mercurial on windows smoothly and what are the
> recommended ways. Like shall I use MYSYS, did things will work in  
> cmd.exe?

What fighting did you have to do?

It works fine in cmd.exe for a user, but I tend to use MSYS.  The '^' is  
treated as a line continuation character in cmd.exe, so it makes revsets  
goofy.  Also, it doesn't understand strong quotes, and will feed them to  
Mercurial.  That can throw off reasonable looking commands, but I can't  
think of an example ATM.  (Filesets/revsets perhaps?)

You need MSYS to run tests, but I think you can use cmd.exe too if you  
only want to build from source.  I recently made a pass over this page  
when I set up a new Win10 laptop:

     https://www.mercurial-scm.org/wiki/BuildingOnWindows

I meant to find a page to describe how to setup MSYS for running tests,  
but everything looked pretty out of date, and I pretty much did the setup  
through the mingw-get GUI.  I've got a fresh Windows install in a VM, so  
maybe I'll get to figuring out what the exact packages are.  In the  
meantime, see this:

     https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-June/099953.html

> If anyone can shed some light on their experiences and tips and tricks on
> how to use mercurial on windows, that will be great!

I have TortoiseHg installed, and evolve enabled without a path (it's  
bundled in the private python there).  That means you'll need to  
pip-install it when running hg from source.  TortoiseHg comes with a lot  
of default options, but it's only visible if *not* running from source.   
Work around that by adding a %include to the hg source repo's .hg/hgrc to  
pick up the thg MergeTools.rc, and possibly the other *.rc files as  
needed.  Merges may go poorly otherwise.

Be careful in MSYS, because `hg config -e` will open the config for the  
MSYS user, *not* mercurial.ini under %USERPROFILE%.   
%USERPROFILE%/mercurial.ini gets loaded after the MSYS user config, so you  
might be able to use that order to tweak what pager is used by MSYS.

The other potential option is to install WSL, and maybe use (Linux)  
Mercurial in there.  I've toyed with Ubuntu for running tests with  
(Windows) hg.exe.  It looks promising, but I'm concerned we'd just be  
trading a set of MSYS problems for a different set of WSL problems.

> I promise to convert all the relevant information I get on this thread  
> and
> some which I accumulated while testing into a wiki page.
>
> Thanks and regards
> Pulkit


More information about the Mercurial-devel mailing list