]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/hg/hg
add hg and python
[plan9front.git] / sys / src / cmd / hg / hg
1 #!/bin/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, incorporated herein by reference.
9
10 # enable importing on demand to reduce startup time
11 try:
12     from mercurial import demandimport; demandimport.enable()
13 except ImportError:
14     import sys
15     sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
16                      ' '.join(sys.path))
17     sys.stderr.write("(check your install and PYTHONPATH)\n")
18     sys.exit(-1)
19
20 # PLAN9 hack to keep hgrc in $home/lib
21 import os
22 os.environ['HGRCPATH']=os.environ['home']+'/lib/hgrc'
23
24 import sys
25 import mercurial.util
26 import mercurial.dispatch
27
28 for fp in (sys.stdin, sys.stdout, sys.stderr):
29     mercurial.util.set_binary(fp)
30
31 mercurial.dispatch.run()