diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-08-13 09:53:04 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-08-13 09:53:04 +0200 |
commit | 73e924d847dd7b6f2db6d66bca1d389a1e2342f2 (patch) | |
tree | e0b436cc210a381a2299bf8ac3d02984cb4048cf /sys/src/cmd/hg | |
parent | bc666e67f4280894a64722e08356dfbdcb157492 (diff) |
hg: hook system_rcpath and user_rcpath instead of polluting enviroment by setting HGRCPATH
Diffstat (limited to 'sys/src/cmd/hg')
-rwxr-xr-x | sys/src/cmd/hg/hg | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/src/cmd/hg/hg b/sys/src/cmd/hg/hg index 9e2cdb0e9..255bdf7b2 100755 --- a/sys/src/cmd/hg/hg +++ b/sys/src/cmd/hg/hg @@ -17,14 +17,22 @@ except ImportError: sys.stderr.write("(check your install and PYTHONPATH)\n") sys.exit(-1) -# PLAN9 hack to keep hgrc in $home/lib -import os -os.environ['HGRCPATH']=os.environ['home']+'/lib/hgrc' - import sys import mercurial.util import mercurial.dispatch +if sys.platform == 'plan9': + def p9sys_rcpath(): + return ['/sys/lib/hgrc'] + + def p9usr_rcpath(): + import os + return [os.environ['home']+'/lib/hgrc'] + + import mercurial.posix + mercurial.posix.system_rcpath = p9sys_rcpath + mercurial.posix.user_rcpath = p9usr_rcpath + for fp in (sys.stdin, sys.stdout, sys.stderr): mercurial.util.set_binary(fp) |