In mercurial, how to configure and use platform dependent hgrc?

The system level hgrc files (in /etc/mercurialand <install-root>/etc/mercurial) obviously depend on the platform, but how can I use the platform dependent hgrc for each user?

A use case is to override the system configuration on a specific platform. For example, we have hg on linux and solaris with various merge tools. How to override the Solaris merge tool when hgrc does not allow any control logic (e.g. if os.uname()[0] == 'SunOS')?

+3
source share
1 answer
  • Keep a set of files .<platform>.hgrcwith what you want to override in each of them.
  • Set the environment variable to .bashrc:

    export PLATFORM=`python -c 'import os; print os.uname()[0],'`
    
  • ~/.hgrc %include , :

    %include ~/$PLATFORM.hgrc
    
+4

Source: https://habr.com/ru/post/1783687/


All Articles