version-controlmercurialconfighgrc

Can I reuse a Mercurial config item?


Here is what I mean:

[paths]
default = some/path/to/something
another_path = [paths.default]/something/else

Can it be done somehow?

Thanks ;)


Solution

  • No, the Mercurial config format has no concept of variables or re-use.

    See the hgrc documentation:

    The values are either free-form text strings, lists of text strings, or Boolean values. Boolean values can be set to true using any of "1", "yes", "true", or "on" and to false using "0", "no", "false", or "off" (all case insensitive).

    Individual settings may support some form of variable parsing, but this does not apply to values in the configuration file in general. Variable support (environment or otherwise) is the exception, not the norm. For example, %include (to include another configuration file) does support environment variables via the Python os.path.expandvars() function, but this does not apply to any other syntax.