Загрузите несколько .hgrc файлов - т.е., некоторые с определенными для машины настройками?

Consolas для меня также

11
задан David Wolever 8 December 2009 в 14:15
поделиться

4 ответа

В mercurial 1.3 и более поздних версиях есть не часто используемая директива % include :

Из 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

, и все будет хорошо.

20
ответ дан 3 December 2019 в 03:04
поделиться

Mercurial will look in several different locations for hgrc files and will load them if present. For system-wide configuration the standard (on UNIX) would be to use /etc/mercurial/hgrc.

See the files section of the hgrc man page for more information.

0
ответ дан 3 December 2019 в 03:04
поделиться

I solve this problem for all my "dot files" in a similar way. On login my shell checks a list of files (hgrc, vimrc, ....) and checks if any of them is older than ${that_name}.global or ${that_name}.local. If it is - cat ${that_name}.{global,local} > ${that_name}. Simple and works great so far. While there's a "better" way (using %include) sometimes processing the config files manually has advantages - for example it will work with mercurial pre-1.3.

5
ответ дан 3 December 2019 в 03:04
поделиться

Mercurial проверяет несколько файлов конфигурации с определенным приоритетом. Таким образом, у вас могут быть глобальные, специфичные для пользователя и специфичные для репозитория настройки. В версии Mercurial> = 1.4 есть команда hg help config , которая описывает это в прекрасном обзоре:

$ hg help config
Configuration Files

    Mercurial reads configuration data from several files, if they exist. Below we list the most specific file first.

    On Windows, these configuration files are read:

    - "<repo>\.hg\hgrc"
    - "%USERPROFILE%\.hgrc"
    - "%USERPROFILE%\Mercurial.ini"
    - "%HOME%\.hgrc"
    - "%HOME%\Mercurial.ini"
    - "C:\Mercurial\Mercurial.ini"
    - "HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial"
    - "<install-dir>\Mercurial.ini"

    On Unix, these files are read:

    - "<repo>/.hg/hgrc"
    - "$HOME/.hgrc"
    - "/etc/mercurial/hgrc"
    - "/etc/mercurial/hgrc.d/*.rc"
    - "<install-root>/etc/mercurial/hgrc"
    - "<install-root>/etc/mercurial/hgrc.d/*.rc"

    The configuration files for Mercurial use a simple ini-file format. A configuration file consists of sections, led by a "[section]" header and followed by
    "name = value" entries:

      [ui]
      username = Firstname Lastname <firstname.lastname@example.net>
      verbose = True

    This above entries will be referred to as "ui.username" and "ui.verbose", respectively. Please see the hgrc man page for a full description of the possible
    configuration values:

    - on Unix-like systems: "man hgrc"
    - online: http://www.selenic.com/mercurial/hgrc.5.html

Вы можете просмотреть свои текущие настройки с помощью hg showconfig .

4
ответ дан 3 December 2019 в 03:04
поделиться
Другие вопросы по тегам:

Похожие вопросы: