For several years, you can extend shell variables inside .hg/hgrc .
So I just do something like this in my .bash_profile :
export HGUSER = $ (host name)
Then inside .hg/hgrc :
username = $ {HGUSER}
The BIG ADVANTAGE of this method is that now you can put EXACTLY THE .hg/hgrc on ALL machines. The same goes for .bash_profile : it can be the same on all machines. This helps when you automate the configuration of the machine!
Note: the HGUSER environment HGUSER is an old way of telling Mercurial about your username, so technically setting HGUSER to .bash_profile should solve the problem yourself, but I think its use is deprecated / not recommended, and I recommend defining username in .hg/hgrc explicitly as shown above.
source share