How to configure Mercurial to use environment variables in mercurial.ini

How can I modify the mercurial.ini file to include an environment variable such as % userprofile% .

Specific situation:

I am learning to use Mercurial. I changed the [ui] section of Mercurial.ini (on my home path) to include:

ignore = c:\users\user\.hgignore 

Where user is my username. The .hgignore file includes file name filters that are used to ignore files during commit. How can I change it from the fact that it is a literal user for the $ user environment variable?

+7
variables mercurial environment configuration
source share
2 answers

It will not interpolate environment variables in hgrc, but I believe that tilda expands correctly in your home / profile directory even in windows.

So:

 ignore = ~/.hgignore 

should work with windows and in other places (even slashes automatically rotate automatically).

For other variables, you need to cheat a little and write a package file / cmd, which does the interpolation in advance, and then transfer the result to Mercury for processing.

+7
source share

Mercurial.ini parses environment variables very well. From my mercurial.ini:

 [ui] ignore = %USERPROFILE%/.hgignore 

It works like a charm. Windows 7 Ultimate x64, Mercurial 1.5 (binary installation). The hgignore file has been honored with both my hg.exe command line and tortoiseHG.

+4
source share

All Articles