hg: hook system_rcpath and user_rcpath instead of polluting enviroment by setting HGRCPATH
This commit is contained in:
parent
bc666e67f4
commit
73e924d847
2 changed files with 24 additions and 8 deletions
16
rc/bin/hg
16
rc/bin/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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue