[PATCH v2] commands: add editconfig command to edit repo/user hgrc

Brodie Rao brodie at bitheap.org
Wed Aug 25 10:49:56 CDT 2010


On Aug 25, 2010, at 8:03 AM, Mads Kiilerich wrote:

> On 08/25/2010 01:39 PM, Martin Geisler wrote:
>> Brodie Rao<brodie at bitheap.org>  writes:
>>
>>> # HG changeset patch
>>> # User Brodie Rao<brodie at bitheap.org>
>>> # Date 1282591581 14400
>>> # Node ID 6d8b574052369e3a88c37a37a51b0e940bd6ac45
>>> # Parent  2315a95ee88759ad2ed250dcbf2fc93be4073688
>>> commands: add editconfig command to edit repo/user hgrc
>>
>> I like this a lot and the patch looks solid. Does anybody have  
>> anything
>> to add?
>
> Something similar was proposed in http://markmail.org/thread/lt5c2ollea4shtzy 
>  , and the relevant comments there should be considered. I think the  
> result back then was -0.2 .
>
> Some comments to this patch:
>
> The documentation is unix-centric and not correct on windows.

Are you referring to the use of "$HOME/.hgrc" in the command help? hg  
paths uses it as well, so that's what I went with.

If you mean the "~/.hgrc" in the example config, I'm not sure what I  
could put there without going into a long explanation of all the  
possible locations.

Do you have any suggestions on what to say instead?

> I think this command should be mentioned in hgrc man page and  
> showconfig help.

Good idea.

> A refactoring introducing something like ui.editfile could perhaps  
> be nice.

Sure. I didn't use ui.edit() because I thought it'd make more sense to  
edit the file directly. It'd be confusing when the user thought they  
opened up .hg/hgrc but there's a random filename in their editor  
instead.

On the other hand, writing the example config directly to .hg/hgrc  
means it'll stay there even if the user didn't change anything in it.

> I don't like hardcoding templates suggesting extensions.

I chose three extensions that don't change Mercurial's behavior or  
provide any dangerous commands and that I think most people enable  
right off the bat (or would if they knew about them).

> If we have templates anyway then I suggest using # for comments  
> instead of ; - I think that is more intuitive, despite not being the  
> standard in windows ini files.

I prefer using ; but it looks like hgrc(5) uses # in its examples, so  
I'll go with that.

> And we definitely don't want comments after the uncommented settings  
> - that gives the misleading hint that comments can be placed  
> everywhere.

Whoops. I'll fix that.



More information about the Mercurial-devel mailing list