Using SourceTree 1.5.3 with embedded Mercurial on OS X 10.6
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Problem
SourceTree fails to clone a repository.
Diagnosis
Environment
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 entrySourceTree goes ahead and uses the system Python version found at /usr/bin/python to execute Mercurial commands
The execution of the Mercurial commands fail
Cause
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+.
Solution
Resolution options
Resolution 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.
Resolution 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.
Was this helpful?