[PATCH] Support remote access to (some) "hgrc" parameters

Glenn Ammons ammons at us.ibm.com
Tue Jan 8 14:11:59 CST 2008


"Thomas Arendsen Hein" <thomas at intevation.de> writes:

> * Glenn Ammons <ammons at us.ibm.com> [20080103 10:32]:
>> To answer your second question, there is no relation between
>> parameters in [public.foo] and those in [foo].  They are separate
>> sections.  The first one is accessible remotely.
>
> This sounds unfortunate as the public values are kind of useless
> then. I'd rather like to see e.g. a [public] section (or use the
> same name as the extension which provides this) and list whole
> sections or single parameters tp publish here.

I'm not sure that I understand the objection.  What do you mean by
"kind of useless"?

One nice property of the "public." convention is that extensions that
don't expect public parameters stop working if their parameters are
moved to a public section.  For example, if the "bank" extension looks
for its password parameter here:

    [bank]
    account = <your account number here>

then it won't work if the user puts it here:

    [public.bank]
    account = <your account number here>

The author of "bank" doesn't have to do anything special to get this
behavior.

Another nice property of "public." is that whether a section is public
or not is obvious from the name of the section.

However, a [public] section could get the first nice property.  We
could require code that expects a public parameter to make a special
call at load-time:

    public.publish("foo", "bar")

A parameter would only be public if an extension publishes it and it
is declared as public in the configuration file(s).  Also, Mercurial
could warn the user about parameters or sections that are declared
public in the configuration file but not published by any extension.
This is actually even better than the "public." convention because
Mercurial could warn about this:

    [public]
    sections = bank

    [bank]
    account = <your account number here>

while the "public." equivalent would work silently:

    [public.bank]
    account = <your account number here>

    [bank]
    account = <your account number here>

By the way, I am converting this code to an extension per Matt
Mackall's suggestion.  I'll send a patch soon.

Thanks for the feedback.
--glenn


More information about the Mercurial-devel mailing list