本文介绍了加载多个.hgrc文件-例如,某些具有机器特定设置的文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想保留两个〜/.hgrc文件:〜/.hgrc和〜/.hgrc.local-一个具有标准"设置(例如,username),另一个具有特定于计算机的设置(例如,设置图形合并工具).

I'd like to keep two ~/.hgrc files: ~/.hgrc and ~/.hgrc.local – one with "standard" settings (eg, username), the other with machine-specific settings (eg, setting a graphical merge tool).

我怎么用汞做到这一点?

How can I do this with hg?

例如,这就是我使用Vim的方法:

For example, this is how I do it with Vim:

# ~/.vimrc
syntax enable
source ~/.vimrc.local

然后:

# ~/.vimrc.local
let work_code = 'code/work/.*'
if expand('%:p:h') =~ work_code ... fi

推荐答案

在Mercurial 1.3及更高版本中有一个不常用的%include指令:

There's a not-often used %include directive in mercurial 1.3 and later:

来自man hgrc:

   A  line  of  the  form %include file will include file into the current
   configuration file.  The  inclusion  is  recursive,  which  means  that
   included  files  can include other files. Filenames are relative to the
   configuration file in which the %include directive is found.

所以去:

   %include ~/.hgrc.local

你应该很好.

这篇关于加载多个.hgrc文件-例如,某些具有机器特定设置的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 12:39