Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In mercurial, how to setup and use per-user platform-dependent hgrc?

Tags:

unix

mercurial

System-level hgrc files (in /etc/mercurial and <install-root>/etc/mercurial) are obviously platform-dependent, but how I can use platform-dependent hgrc on a per user basis?

The use case is to override a system config on a specific platform. For example, we have hg on linux and solaris with different merge tools. How do I override just the solaris merge tool, when hgrc doesn't allow any control logic (like if os.uname()[0] == 'SunOS')?

like image 297
Geoffrey Zheng Avatar asked Nov 01 '25 15:11

Geoffrey Zheng


1 Answers

  1. Keep a set of .<platform>.hgrc files with whatever you want to override in each one.
  2. Set an environment variable in your .bashrc:

    export PLATFORM=`python -c 'import os; print os.uname()[0],'`
    
  3. In your ~/.hgrc file, use %include at the end to include the right file:

    %include ~/$PLATFORM.hgrc
    
like image 159
Steve Losh Avatar answered Nov 03 '25 11:11

Steve Losh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!