##// END OF EJS Templates
hg: add support for HGUNICODEPEDANTRY environment variable...
Augie Fackler -
r21812:73e4a02e default
parent child Browse files
Show More
@@ -1,38 +1,43 b''
1 1 #!/usr/bin/env python
2 2 #
3 3 # mercurial - scalable distributed SCM
4 4 #
5 5 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
6 6 #
7 7 # This software may be used and distributed according to the terms of the
8 8 # GNU General Public License version 2 or any later version.
9 9
10 10 import os
11 11 import sys
12 12
13 if os.environ.get('HGUNICODEPEDANTRY', False):
14 reload(sys)
15 sys.setdefaultencoding("undefined")
16
17
13 18 libdir = '@LIBDIR@'
14 19
15 20 if libdir != '@' 'LIBDIR' '@':
16 21 if not os.path.isabs(libdir):
17 22 libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
18 23 libdir)
19 24 libdir = os.path.abspath(libdir)
20 25 sys.path.insert(0, libdir)
21 26
22 27 # enable importing on demand to reduce startup time
23 28 try:
24 29 from mercurial import demandimport; demandimport.enable()
25 30 except ImportError:
26 31 import sys
27 32 sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
28 33 ' '.join(sys.path))
29 34 sys.stderr.write("(check your install and PYTHONPATH)\n")
30 35 sys.exit(-1)
31 36
32 37 import mercurial.util
33 38 import mercurial.dispatch
34 39
35 40 for fp in (sys.stdin, sys.stdout, sys.stderr):
36 41 mercurial.util.setbinary(fp)
37 42
38 43 mercurial.dispatch.run()
General Comments 0
You need to be logged in to leave comments. Login now