Default mercurial.ini for Windows
Stephen Darnell
stephen at darnell.plus.com
Thu May 4 17:28:30 CDT 2006
In util_win32.py there is the following code:
def system_rcpath_win32():
'''return default os-specific hgrc search path'''
proc = win32api.GetCurrentProcess()
filename = win32process.GetModuleFileNameEx(proc, 0)
return [os.path.join(os.path.dirname(filename), 'mercurial.ini')]
Is there a reason why sys.executable wouldn't do the same more portably?
I don't use the py2exe form on Windows, and the module filename is
always c:\Python2.4\python.exe which results in the default
mercurial.ini being located in c:\python2.4\mercurial.ini which I
guess does no harm, but isn't documented and 'feels a bit odd'.
This doesn't work either when win32api is not included - making it a bit
more quirky.
Would it be better to only do this for the py2exe'd form?
Presumably there is a way to detect you're running from a py2exe'd version?
Alternatively, should we make the default for all platforms
to be look in the python directory? (But what about permissions...)
For comparison, Unix uses the path from argv[0], /etc/mercurial/hgrc
and /etc/mercurial/hgrc.d/*.rc
Isn't there a way to ask python what the absolute pathname for a module is?
This would resolve (portably) to the installation directory, no?
Final question on consistency, why is it called hgrc on non-Windows and
mercurial.ini on Windows? Surely this makes describing the situation harder
than it could be, all for the sake of 'dumbing down' to Windows users.
What's wrong with any of hgrc, hg.rc, hg.ini, hgconfig.ini, or
mercurial.(rc|ini|cfg) for all platforms? (with the corresponding dot
prefixed form in the users home directory)
I'd also suggest a new command or derivative of an existing command that can
display information about the version being run, e.g.:
version, hgrc files/locations, key settings (such as username, editor,
diff)
where modules are loaded from/installed
key supported features that might be platform specific (e.g. hardlinks,
case sesitivity)
installed extensions
repository format in use (revlogng vers?)
repository source(s) (e.g. default path)
This sort of thing is useful for debugging someone's setup.
My proposal is to ditch "hg paths"+"hg version" and replace it with a "hg
info"
Regards,
Stephen
More information about the Mercurial
mailing list