实际上,如何设置和使用基于用户平台的hgrc? [英] In mercurial, how to setup and use per-user platform-dependent hgrc?

查看:50
本文介绍了实际上,如何设置和使用基于用户平台的hgrc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(/etc/mercurial<install-root>/etc/mercurial中的)系统级hgrc文件显然是平台相关的,但是如何在每个用户的基础上使用平台相关的hgrc?

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?

用例是在特定平台上覆盖系统配置.例如,我们在Linux和solaris上具有使用不同合并工具的hg.当hgrc不允许任何控制逻辑(例如if os.uname()[0] == 'SunOS')时,如何仅覆盖solaris合并工具?

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')?

推荐答案

  1. 保留一组.<platform>.hgrc文件以及每个文件中要覆盖的内容.
  2. .bashrc中设置环境变量:

  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],'`

  • 在您的~/.hgrc文件中,最后使用%include包括正确的文件:

  • In your ~/.hgrc file, use %include at the end to include the right file:

    %include ~/$PLATFORM.hgrc
    

  • 这篇关于实际上,如何设置和使用基于用户平台的hgrc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆