Exclude config files.

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Sep 26 12:23:34 UTC 2008


On Fri, 26 Sep 2008 12:47:18 +0200, Alpár Jüttner <alpar at cs.elte.hu> wrote:
> Thank you for the answer.

You are welcome :)

> Is that possible to switch off parsing .hg/hgrc, too?

An empty HGRCPATH overrides ~/.hgrc too.  What it does _not_ override is
the workspace/repository-specific `.hg/hgrc' file.

Here are the extensions I have enabled in my ~/.hgrc file:

  $ hg debugconfig extensions
  extensions.alias=
  extensions.convert=
  extensions.extdiff=
  extensions.gpg=
  extensions.graphlog=
  extensions.mq=
  extensions.notify=
  extensions.patchbomb=
  extensions.purge=
  extensions.rebase=
  extensions.record=
  extensions.transplant=
  $

By setting HGRCPATH you can override *both* the system <prefix>/etc/hgrc
file and ~/.hrgc:

  $ env HGRCPATH='' hg debugconfig extensions
  $

If HGRCPATH is empty, then Mercurial only looks at .hg/hgrc of the
current repository.

When HGRCPATH is not empty, it can be a list of items; each item in
HGRCPATH is separated by the OS-specific path separator, and can be
either a file or a directory.  If it is a file it is loaded as one of
the config files of Mercurial. If it is a directory, then all files that
have an ".rc" extension from that directory are parsed as config files.

The workspace-specific ".hg/hgrc" file is _always_ loaded, so if you
really want to run Mercurial without _any_ configuration, you have to
make sure that both of the following are true:

  * HGRCPATH is empty or it is set to an empty file (i.e. in UNIX the
    special `/dev/null' device is a safe choice for a file that will
    always appear empty when you try to read from it).

  * The .hg/hgrc file of the local repository is empty (or it includes
    only options that are relatively `harmless', like a short [paths]
    section).

I hope this is a bit more useful than the original terse reply.  I was
in a bit of a hurry earlier :-)

Giorgos





More information about the Mercurial mailing list