PageRenderTime 18ms CodeModel.GetById 16ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/hg

https://bitbucket.org/tortoisehg/hgtk/
Python | 36 lines | 20 code | 6 blank | 10 comment | 5 complexity | 62dadffaa486b566f07a2e7c77a7cd5a MD5 | raw file
 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, incorporated herein by reference.
 9
10import os, sys
11
12cwd = os.getcwd()
13if cwd in sys.path:
14    # Always remove current directory for Windows exe
15    if hasattr(sys, "frozen"):
16        sys.path.remove(cwd)
17    elif os.path.dirname(__file__) != cwd:
18        sys.path.remove(cwd)
19        sys.path.append(cwd)
20
21# enable importing on demand to reduce startup time
22try:
23    from mercurial import demandimport; demandimport.enable()
24except ImportError:
25    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
26                     ' '.join(sys.path))
27    sys.stderr.write("(check your install and PYTHONPATH)\n")
28    sys.exit(-1)
29
30import mercurial.util
31import mercurial.dispatch
32
33for fp in (sys.stdin, sys.stdout, sys.stderr):
34    mercurial.util.set_binary(fp)
35
36mercurial.dispatch.run()