how to configure the global .hgrc file from the commandline

Tony Mechelynck antoine.mechelynck at gmail.com
Sun May 24 15:26:32 UTC 2020


On Sun, May 24, 2020 at 5:04 PM Uwe Brauer <oub at mat.ucm.es> wrote:
>
> >>> "TM" == Tony Mechelynck <antoine.mechelynck at gmail.com> writes:
>
>    > On Sun, May 24, 2020 at 2:35 PM Uwe Brauer <oub at mat.ucm.es> wrote:
>    >>
>    >>
>    >>
>    >> Hi
>    >>
>    >> That may sound bizarre. But lately I collaborate with colleagues, who
>    >> don't have much interest in OS details, and use different OS. So it is
>    >> sometimes not clear to me, especially for Windows users, where the
>    >> corresponding global .hgrc is located.
>    >>
>    >> That's why I would like to know how one could configure the global .hgrc
>    >> file from the command-line, especially adding extensions.
>    >>
>    >> I googled but could not find anything
>    >> Thanks
>    >>
>    >> Uwe Brauer
>
>    > To enable, let's say, the mq extension "as if" there was a line "mq="
>    > in section "[extensions]":
>
>    > hg --config extensions.mq= (other global options) (hg command)
>    > (specific options)
>
> Now I am confused
>
> I want
>
> [extensions]
> mq =
>
> So I should just fire up
>
> hg --config extensions.mq=  global
>
> ?
>
> Thanks
>
> Uwe Brauer

No, "hg global" doesn't mean anything AFAIK. "Global options" are
those that come between "hg" and the command (which is incoming, pull,
commit, etc.). "Specific options are specific to one command and apply
only to it.

You found something I didn't know, which is how to edit the config
file. Let's push the mq  example a little further:

hg --config extensions.mq=   qqueue -c newqueue
(edit some file in the tree)
hg --config extensions.mq=   qnew -U -m 'fix build eror in somefile.c'
hg --config extensions.mq=   qpop

In this case the --config is not permanent. Your method is more
elegant. This way might be more suitable to enable or disable paging
for the duration of one command. Also, let's say, to know if you want
to enable some specific extension, because its help is only accessible
if theextensio is enabled. To know what mq does, then if it is
disabled you would need

hg --config extensions.mq=   help mq


Best regards,
Tony.



More information about the Mercurial mailing list