Is there anything in mercurial to 'parameterise' values in a file?

Steve Fink sphink at gmail.com
Fri Feb 12 21:17:29 UTC 2021


The only mercurial-specific thing I can think of is: don't check it
into version control.

More usefully, I normally deal with similar situations by having
multiple files. Either with an include directive, or having the loader
iterate over multiple possibilities and load them all in. Or a
preprocessor that uses either of those approaches and outputs a single
output file to be loaded in.

For example, I have a common ~/.hgrc configuration that I check into a
public repository, and then a private ~/.config/hg/hgrc that is
automatically loaded in addition where I keep my secret keys and
site-specific customization.

Obviously, if you don't control the setup then none of this may apply.

I guess a final, hg-specific option would be to use a hook to do the
preprocessing: commit the general configuration file, and have an
update hook that concatenates it with a local file to produce the full
configuration file that is actually used. I have no idea how robust
this might be.

On Fri, Feb 12, 2021 at 11:27 AM Chris Green <cl at isbd.net> wrote:
>
> I suspect this may be outside mercurial but I'm sure that others here
> may know of solutions.
>
> I have a file that is common to many systems but has one line that is
> configured with system related information (in my particular case it's
> the system's domain name, but there must  be other similar cases).
>
> Is there any way of managing this type of thing?
>
> --
> Chris Green
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial



More information about the Mercurial mailing list