equal
deleted
inserted
replaced
1 #!/usr/bin/env python |
|
2 # |
|
3 # mercurial - scalable distributed SCM |
|
4 # |
|
5 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
6 # |
|
7 # This software may be used and distributed according to the terms of the |
|
8 # GNU General Public License version 2 or any later version. |
|
9 |
|
10 import os |
|
11 import sys |
|
12 |
|
13 libdir = '@LIBDIR@' |
|
14 |
|
15 if libdir != '@' 'LIBDIR' '@': |
|
16 if not os.path.isabs(libdir): |
|
17 libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), |
|
18 libdir) |
|
19 libdir = os.path.abspath(libdir) |
|
20 sys.path.insert(0, libdir) |
|
21 |
|
22 # enable importing on demand to reduce startup time |
|
23 try: |
|
24 from mercurial import demandimport; demandimport.enable() |
|
25 except ImportError: |
|
26 import sys |
|
27 sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" % |
|
28 ' '.join(sys.path)) |
|
29 sys.stderr.write("(check your install and PYTHONPATH)\n") |
|
30 sys.exit(-1) |
|
31 |
|
32 import mercurial.util |
|
33 import mercurial.dispatch |
|
34 |
|
35 for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
36 mercurial.util.setbinary(fp) |
|
37 |
|
38 mercurial.dispatch.run() |
|