Last active
October 21, 2015 18:05
-
-
Save binki/65e47b597d02362ff5be to your computer and use it in GitHub Desktop.
Run python with any Windows mercurial install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@getattr(''' 2>NUL | |
@ECHO OFF | |
: # Ignore any ERRORLEVEL infection attempt | |
SET ERRORLEVEL= | |
hg --config extensions.runcmd=%0\..\hgpy.cmd -- %* | |
EXIT /B %ERRORLEVEL% | |
''', 'format') | |
def n(): | |
pass | |
import imp | |
import sys | |
try: | |
dashdash_i = sys.argv.index('--') | |
if dashdash_i == len(sys.argv) - 1: | |
print('Interactive mode not supported') | |
sys.exit(1) | |
sys.argv = sys.argv[dashdash_i + 1:] | |
imp.load_source('__main__', sys.argv[0]) | |
except (SystemExit): | |
raise | |
except: | |
print(sys.exc_info()) | |
sys.exit(1) | |
# Do not relinquish control to Mercurial | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment