hgrc.5.text FILES content, ordering implied?

Douglas Philips dgou at mac.com
Thu Aug 27 07:04:57 CDT 2009


On or about 2009 Aug 27, at 4:11 AM, Martin Geisler indited:
> Douglas Philips <dgou at mac.com> writes:
>> On 2009 Aug 26, at 5:34 PM, Martin Geisler wrote:
>>> The responsible code is this:
>>>
>>> http://www.selenic.com/hg/index.cgi/file/37042e8b3b34/mercurial/posix.py#l45
>>> http://www.selenic.com/hg/index.cgi/file/37042e8b3b34/mercurial/windows.py#l80
>>>
>>> You can see that the Windows code explicitly looks for both '.hgrc'
>>> and
>>> 'mercurial.ini' whereas the Posix file looks for '.hgrc' only.
>>>
>>> I don't know why it is inconsistent like this -- I would have  
>>> expected
>>> it to either read both files on all systems or read just a single
>>> system-specific file on each system.
>>
>> I'm perfectly happy to submit patches, but is it to thw hgrc man page
>> or is it the consumer of user_rcpath()'s results that should be
>> stopping after it finds one of the "candidate" files?
>
> The idea is to accumulate configuration values from different files,
> loaded in order from least specific (/etc/mercurial on Unix) to most
> specific (.hg/hgrc). I think that is fine as it is.
>
> The question is mostly if we should let hg read mercurial.ini on Unix
> systems?


I am very concerned by this, and looking at the code in windows.py, it  
sure has the feel of "Shaw, Pshaw, here's a smattering of files,  
you'll probably find -one- of 'em."

Please explain the logic behind needing both mercurial.ini and .hgrc  
on Windows, in the same directory, and why it is better to extend that  
to non-Windows platforms than to fix Windows. There are no comments in  
windows.py/user_rcpath() that explain why its doing what it's doing.  
Annotate on the file just shows those lines were a part of Matt's  
"util: split out posix, windows, and win32 modules" e710f0f592b2  
changeset.
Going back to before that split, it looks as if Stefan Rank, changeset  
09a8be3e5bfb, added the ".hgrc"s to the windows code. The commit  
comment says:
     Also search for .hgrc if mercurial.ini not found on windows
It isn't a matter of "if mercurial.ini not found on windows", since  
the ui code would, even then, have read both files if both were present.
I don't know if the original patch was buggy, or if the commit comment  
was incomplete in explanation, or what.

I'd like to understand why the code is as it is before changing either  
the windows.py code or any other platform rc file related code.

-Doug



More information about the Mercurial-devel mailing list