Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I 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 have modified the [ui] section of Mercurial.ini (in my home path) to include:

ignore = c:\users\user\.hgignore

Where user is my username literal. The .hgignore file includes filename filters that are used to ignore files during commit. How can I alter it from being the a literal user to an environment variable $user?

like image 352
MW_dev Avatar asked Mar 08 '10 04:03

MW_dev


People also ask

Where is the mercurial INI file?

Mercurial on Windows has a three-tier configuration system. A site-wide configuration file in C:\Program Files\TortoiseHg\Mercurial. ini This file is read first and thus has the lowest priority. A per-user configuration file in C:\Documents and Settings\username\Mercurial.


1 Answers

It won't interpolate environment variables in the hgrc, but I do believe that tilda expands to your home/profile directory correctly even on windows.

So:

ignore = ~/.hgignore

should work on windows and elsewhere (even the slashes get spun the wrong way automatically for you).

For other variables you'd need to get a little tricker and write a batch/cmd file that does the interpolation in advance and then hands the result off to mercurial for processing.

like image 56
Ry4an Brase Avatar answered Sep 18 '22 12:09

Ry4an Brase