Skip to content

Instantly share code, notes, and snippets.

@binki
Last active October 21, 2015 18:05
Show Gist options
  • Save binki/65e47b597d02362ff5be to your computer and use it in GitHub Desktop.
Save binki/65e47b597d02362ff5be to your computer and use it in GitHub Desktop.
Run python with any Windows mercurial install
@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