Load multiple .hgrc files - ie, some with machine-specific settings?

前端 未结 4 1452
北恋
北恋 2021-01-11 15:42

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, se

4条回答
  •  隐瞒了意图╮
    2021-01-11 16:33

    Mercurial checks for a number of configuration files with a specific priority. This way you can have global, user-specific and repository-specific settings. Mercurial version >= 1.4 has a hg help config command which describes this in a nice overview:

    $ 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:
    
        - "\.hg\hgrc"
        - "%USERPROFILE%\.hgrc"
        - "%USERPROFILE%\Mercurial.ini"
        - "%HOME%\.hgrc"
        - "%HOME%\Mercurial.ini"
        - "C:\Mercurial\Mercurial.ini"
        - "HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial"
        - "\Mercurial.ini"
    
        On Unix, these files are read:
    
        - "/.hg/hgrc"
        - "$HOME/.hgrc"
        - "/etc/mercurial/hgrc"
        - "/etc/mercurial/hgrc.d/*.rc"
        - "/etc/mercurial/hgrc"
        - "/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 
          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
    

    You can list your current settings with hg showconfig.

提交回复
热议问题