[PATCH 0 of 2 v3] commands: add editconfig

Brodie Rao brodie at bitheap.org
Sat Oct 2 20:59:19 CDT 2010


On Sep 26, 2010, at 7:19 PM, Mads Kiilerich wrote:

> Brodie Rao wrote, On 09/27/2010 12:14 AM:
>> On Sun, Sep 26, 2010 at 6:02 PM, Martin Geisler<mg at lazybytes.net>   
>> wrote:
>>> Brodie Rao<brodie at bitheap.org>  writes:
>>>
>>>> This series adds "hg editconfig".
>>>>
>>>> I've incorporated feedback on my previous patch submission:
>>>>
>>>> - "hg help showconfig" now mentions editconfig.
>>> I like these patches, but it just occured to me that instead of  
>>> having
>>> two commands (editconfig and showconfig) to do different aspects  
>>> of the
>>> same thing, maybe we could have
>>>
>>>  hg config        ->  showconfig
>>>  hg config --edit ->  editconfig
>
> (see also http://www.selenic.com/pipermail/mercurial-devel/2010-April/thread.html#20764 
> )
>
>> showconfig already has -u, so --user couldn't have a short option.
>>
>> Another thing to consider: showconfig takes positional arguments,
>> while editconfig takes none.
>>
>> What do you do in this case?
>>
>>   $ hg config --edit ui.username
>>
>> Does it silently ignore ui.username?
>
> No; aborting would be much better - especially as a first milestone.

This seems confusing to me. Do we have any commands now that behave  
like this? It seems strange that giving arguments works fine for the  
config command, but adding --edit completely changes the command's  
behavior and makes them invalid.

I don't think config should gain --edit unless it's going to support  
positional arguments.

>> Does it open up the file that it's defined in?
>
> I hadn't considered that. That could perhaps be nice in some cases,  
> but I'm not sure it is sufficiently "nice to have" to make it a  
> feature we want. Leaving that to a separate patch might be a good  
> idea.
>
>> What if you specify two settings that are in
>> different files?
>>
>> What if the setting isn't set anywhere? Do you give an error?
>>
>> And what would this do?
>>
>>   $ hg config --edit --user ui.username
>
> Abort abort abort.
>
>
>>> Maybe we could even make
>>>
>>>  hg config --set ui.username='Martin Geisler'
>>>
>>> work, provided we have a good library for editing the .ini files.
>
> (I know this was retracted, but see also Matts fine answer to that  
> idea in http://www.selenic.com/pipermail/mercurial-devel/2010-April/020767.html 
>  .)
>
>>> My TortoiseHg used to complain a lot about me missing an 'iniparse'
>>> module which it said would allow me to edit the settings... so I  
>>> guess
>>> we should start by looking at that :)
>
> I (also) think it is great to have such functionality in TortoiseHg  
> or in the cedit extension. (But not in core Mercurial.)
>
> /Mads
>



More information about the Mercurial-devel mailing list