Patch: allow .hgrc in addition to mercurial.ini on Windows, see also issue 999

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Thu Feb 21 00:59:18 CST 2008


Haven't checked the patch, but +1 on the idea. Has been bothering me too.
-peo


On Wed, Feb 20, 2008 at 9:39 PM, Stefan Rank <list-ener at strank.info> wrote:
> # HG changeset patch
>  # User Stefan Rank <strank(AT)strank(DOT)info>
>  # Date 1203539502 -3600
>  # Node ID 02fc21c9fb728e7d4586b48d527a7411e98f7957
>  # Parent  9b817c0a82f1cd556bf3803b7ea2caea4918509c
>  Also search for .hgrc if mercurial.ini not found on windows
>
>  diff -r 9b817c0a82f1 -r 02fc21c9fb72 mercurial/util.py
>  --- a/mercurial/util.py Thu Feb 14 10:55:17 2008 -0600
>  +++ b/mercurial/util.py Wed Feb 20 21:31:42 2008 +0100
>  @@ -965,13 +965,15 @@
>       def user_rcpath():
>           '''return os-specific hgrc search path to the user dir'''
>           try:
>  -            userrc = user_rcpath_win32()
>  +            path = user_rcpath_win32()
>           except:
>  -            userrc = os.path.join(os.path.expanduser('~'), 'mercurial.ini')
>  -        path = [userrc]
>  +            home = os.path.expanduser('~')
>  +            path = [os.path.join(home, 'mercurial.ini'),
>  +                    os.path.join(home, '.hgrc')]
>           userprofile = os.environ.get('USERPROFILE')
>           if userprofile:
>               path.append(os.path.join(userprofile, 'mercurial.ini'))
>  +            path.append(os.path.join(userprofile, '.hgrc'))
>           return path
>
>       def parse_patch_output(output_line):
>  diff -r 9b817c0a82f1 -r 02fc21c9fb72 mercurial/util_win32.py
>  --- a/mercurial/util_win32.py   Thu Feb 14 10:55:17 2008 -0600
>  +++ b/mercurial/util_win32.py   Wed Feb 20 21:31:42 2008 +0100
>  @@ -255,7 +255,8 @@
>           appdir = shell.SHGetPathFromIDList(
>               shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA))
>           userdir = os.path.dirname(appdir)
>  -    return os.path.join(userdir, 'mercurial.ini')
>  +    return [os.path.join(userdir, 'mercurial.ini'),
>  +            os.path.join(userdir, '.hgrc')]
>
>   class posixfile_nt(object):
>       '''file object with posix-like semantics.  on windows, normal
>  _______________________________________________
>  Mercurial-devel mailing list
>  Mercurial-devel at selenic.com
>  http://selenic.com/mailman/listinfo/mercurial-devel
>


More information about the Mercurial-devel mailing list