[PATCH 2 of 2 v3] commands: add editconfig command to edit repo/user config

Martin Geisler mg at lazybytes.net
Sat Sep 25 08:20:30 CDT 2010


Mads Kiilerich <mads at kiilerich.com> writes:

>  Brodie Rao wrote, On 09/23/2010 03:31 AM:
>> # HG changeset patch
>> # User Brodie Rao<brodie at bitheap.org>
>> # Date 1285205392 18000
>> # Node ID 8a156b68be591a89654729c64bc5eb87e7caae4d
>> # Parent  0bf68f8654746f151617e6179e3b273b08f5f211
>> commands: add editconfig command to edit repo/user config
>>
>> "hg editconfig" provides a happy medium between making the user edit
>> their config manually and providing a command to edit specific
>> settings.
>>
>> Without any arguments, the command will load the repo's hgrc in an
>> editor if the user is inside a repo. When run outside a repo, it
>> aborts. To edit the user config, a -u/--user option is provided.
>>
>> If there's no user or repo config, editconfig will provide configs
>> with commented out examples.
> ...
>> +def editconfig(ui, repo, **opts):
>> +    """load configuration file in configured editor
>> +
>> +    With no arguments, the current repository's ``.hg/hgrc`` is
>> +    loaded in your configured editor.
>> +
>> +    With --user, your user configuration file is loaded.
>> +    """
>> +
>> +    def writeconfig(path, example):
>> +        if example == 'user':
>> +            s = _(
>> +"""# This is an example config file. Uncomment settings to enable them.
>
> _If_ we want such templates then it might be a bit prettier to threat
> it like a help topic and store it in mercurial/help/*.txt

I don't think we should make a new help topic for this just because that
makes it easier for us to organize our source tree.

We could store it somewhere else and incorporate it dynamically in 'hg
help config' or perhaps better in 'hg help editconfig'.

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100925/e22d7be1/attachment.pgp>


More information about the Mercurial-devel mailing list