Using SourceTree 1.5.3 with embedded Mercurial on OS X 10.6
問題
SourceTree fails to clone a repository.
診断
環境
- Mac OS X 10.6 - Snow Leopard
- Python default version 2.5.4
- SourceTree version 1.5.3 and embedded Mercurial 2.2.2
Diagnostic Steps
- clone a repository such as https://bitbucket.org/sinbad/ssselectabletoolbar with the
New
menu entry - SourceTree goes ahead and uses the system Python version found at /usr/bin/python to execute Mercurial commands
- The execution of the Mercurial commands fail
原因
The commands fail because of syntax errors with regards to Mac OS X 10.6 - Snow Leopard having Python 2.5.4 but Mercurial needing Python 2.6+.
Resolution options
ソリューション 1
When SourceTree is using embedded Mercurial, it is actually calling the python script at "/Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local
". Editing this script will show that the first line is calling "#!/usr/bin/env python
". This is in fact the shebang that tells embedded Mercurial to use the system python (reference: http://en.wikipedia.org/wiki/Shebang_(Unix)#Strengths). If that first line is replaced with something like "#!<path-to-python-2.6+>"
then SourceTree with embedded Mercurial would call the version of Python to be used instead of the system Python. In addition, it might be necessary to disable some hg extension, such as hgsubversion or hgattic for example.
ソリューション 2
Rename the /usr/bin/python
folder and create a symbolic link to a higher Python version at /usr/bin/python
.
Mercurial commands can be executed and the repository can then be cloned.