开发者

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%.

Spe开发者_StackOverflowcific 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?


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.


The mercurial.ini parses the environment variables just fine. From my mercurial.ini:

[ui]
ignore = %USERPROFILE%/.hgignore

Works like a charm. Windows 7 Ultimate x64, Mercurial 1.5 (binary installation). The hgignore file is honored both my the command line hg.exe, and tortoiseHG.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜