PageRenderTime 221ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/hg

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