Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I include sub-config files in my mercurial .hgrc?

I want to keep my main .hgrc in revision control, because I have a fair amount of customization it in, but I want to have different author names depending on which machine I'm using (work, home, &c.).

The way I'd do this in a bash script is to source a host-local bash script that is ignored by Mercurial, but I'm not sure how to do this in the config file format Mercurial uses.

like image 999
Chris R Avatar asked Oct 25 '10 15:10

Chris R


People also ask

Where is HGRC file on Windows?

hg/hgrc file. Global configuration like the username setting is typically put into: %USERPROFILE%\mercurial. ini (on Windows)

How do you set a username in Heartgold?

If you specify a -u option to the hg commit command on the command line, followed by a username, this is always given the highest precedence. If you have set the HGUSER environment variable, this is checked next. If you create a file in your home directory called . hgrc, with a username entry, that will be used next.


1 Answers

You can do this using the not-often-used but been-there-awhile include syntax.

Put your machine specific stuff in your ~/.hgrc and then include a constant-across-all-systems boilerplate config file. Example:

[ui]
username=You <you@somewhere>

%include .hgrc-boilerplate

Track the .hgrc-boilerplate file in revision control.

See the hgrc man page for more details.

like image 163
Ry4an Brase Avatar answered Sep 28 '22 02:09

Ry4an Brase