I am trying to export a Mercurial repo to GitHub using hg-fast-export and Github Bash for Windows. It choked on the line from mercurial import node
because mercurial doesn't support Python 3.
I installed Python 2.7 and tried shebang lines (#! /Python27/python
) and also alias python='c:/Python27/python'
. That worked to make python --version
report 2.7, but the hg-fast-export.sh still invokes Python 3 because it contains the line
PYTHON=${PYTHON:-python}
and that evaluates to Python 3.4.3.
Can you explain how to change this to use a different Python version and also what's going on with the syntax here? I couldn't really Google the meaning of ${}
or :-
in the shell. Comments on how likely my approach is to get this running on Windows could also be helpful.
Edit: Thanks for the explanations of :-
. Since the parameter expansion was not needed, I guess the answer to my question was "You have to set PYTHON='c:/Python27/python'
in the same line as the script for it to use that value." I expected it to be like PATH where you can set it independently for following lines to use.